[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gettimeofday() and clock
- To: linuxgames@sunsite.dk
- Subject: gettimeofday() and clock
- From: Francesco Orsenigo <xarvh@lombardiacom.it>
- Date: Sun, 25 Aug 2002 20:26:34 +0200
- Delivered-To: archiver@seul.org
- Delivered-To: mailing list linuxgames@sunsite.dk
- Delivery-Date: Sun, 25 Aug 2002 14:19:37 -0400
- Mailing-List: contact linuxgames-help@sunsite.dk; run by ezmlm
- Organization: Xarvh Project
- Reply-To: linuxgames@sunsite.dk
I wrote some timer code using gettimeofday(), as it seems to me the only
linux `standard` way to obtain non-blocking subsecond precision.
However i find that the tv_usec field increases by 10000 per second instead
of 1000.
May this depend on the CPU? (k7 850Mhz)
Is possible to know the number of usecs ('u' stands for `micro`?) per second
without calling other timing functions?
Is possible to get subsecond precision with other non-blocking functions?
I've put the test program here:
http://freeweb.lombardiacom.it/xarvh/timer.c
Regards,
Francesco Orsenigo, Xarvh Project