site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Oct 15, 2008, at 3:07 PM, Dave Zarzycki wrote: Mark, http://developer.apple.com/qa/qa2004/qa1340.html Brian -- Brian Mastenbrook brian@mastenbrook.net http://brian.mastenbrook.net/ _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... gettimeofday() is what you want. There are also timeradd() and timersub() macros for computing deltas. davez Mark is looking for a monotonic timer. gettimeofday() is susceptible to time shifts caused by NTP synchronization or user setting of the system time. In this case it sounds like he needs to know when a certain amount of real time has passed, independent of the setting of the system clock. In this case I would register to receive system sleep events and use gettimeofday() to track the amount of time the system has been asleep, but use mach_absolute_time() for monotonic time while the machine is awake. See the following tech note for information on how to receive sleep and wake events: This email sent to site_archiver@lists.apple.com