LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-03-2005, 09:55 AM   #1
addy86
Member
 
Registered: Nov 2004
Location: Germany
Distribution: Debian Testing
Posts: 332

Rep: Reputation: 31
Question High resolution clock


How can I get a high resolution time, ie. something similar to times(), but at a much higher resolution (microseconds would be ideal, milliseconds are too long). Requirements:
1) It doesn't have to be wall time.
2) It mustn't be processor time but real time.
3) The above described resolution.
4) If possible, it should be POSIX-compliant or similar, ie. not only available on Linux.

I couldn't find anything fitting, neither with Google nor in this forum.
 
Old 09-03-2005, 10:05 AM   #2
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534

Rep: Reputation: 100Reputation: 100
RTC?
 
Old 09-03-2005, 10:57 AM   #3
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Have you looked at setitimer()?
 
Old 09-03-2005, 02:13 PM   #4
addy86
Member
 
Registered: Nov 2004
Location: Germany
Distribution: Debian Testing
Posts: 332

Original Poster
Rep: Reputation: 31
@Matir: No, I haven't, but it seems that setitimer() is a timer, but I need a clock.

@Linux.tar.gz: What frequency does the RTC have? For mplayer I have set it to 1024, I suppose these are Hertz. That's as inaccurate as SDL's SDL_GetTicks() (I'm programming a game and need a time source to measure fps).


I remember there were two API functions in Windows: QueryPerformanceCounter() and QueryPerformanceFreq(). Is there anything similar in Linux?
 
Old 09-03-2005, 11:26 PM   #5
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534

Rep: Reputation: 100Reputation: 100
Mmm i suggest you to post another thread named "Need a time source to measure fps", and link it to this one.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
high resolution webcam ahz10 Linux - Hardware 6 05-24-2005 04:55 PM
High Horizontal Resolution on X - How do I? nitrousoxide82 Linux - General 2 05-23-2005 10:50 PM
High Resolution Timers swinchen Programming 2 07-22-2004 10:34 AM
High resolution on booting spank Linux - Newbie 4 08-26-2003 03:35 AM
High Resolution Timers snoopy42 Linux - General 2 12-10-2002 05:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration