Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 04-16-2004, 01:39 PM   #1
Registered: Apr 2004
Location: Maine (USA)
Distribution: Slackware 9.1
Posts: 45

Rep: Reputation: 15
High Resolution Timers

Hi Everyone.

I have been fooling around with some graphics programming and I am at the point now where I need to start thinking about timing. Can anyone give me a suggestion for a high resolution timer in linux? I have been fooling around with "gettimeofday" and that seems to work. I just want to make sure that there isn't a better, more well known way.

Also what happens when gettimeofday overflows? (I think it occurs about ever 49 days) But timing could get seriously screwed up unless there is a way to trap for that.


Old 04-16-2004, 01:51 PM   #2
jim mcnamara
Registered: May 2002
Posts: 964

Rep: Reputation: 36
getitimer(), setitimer(), gettimeofday()

all use the struct timeval. That's about it for usec timing.

When unix was young most systems had trouble staying up for four weeks let alone 49 days. I think the value rolls over to zero.
Old 07-22-2004, 10:34 AM   #3
LQ Newbie
Registered: Mar 2004
Distribution: United Linux(they forced me to)
Posts: 16

Rep: Reputation: 0
if you want something faster/more accurate look at this.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 clock addy86 Programming 4 09-03-2005 11:26 PM
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 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 > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:32 AM.

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