site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Here is some code for a CoreServices tool that shows the issue. #include <CoreServices/CoreServices.h> #include <mach/mach_time.h> #include <unistd.h> If you run in Terminal you get output that looks like this: millis = 13528873; seconds = 13528 millis = 13530874; seconds = 13530 millis = 13532874; seconds = 13532 millis = 13534874; seconds = 13534 millis = 13536874; seconds = 13536 millis = 13538875; seconds = 13538 millis = 13540875; seconds = 13540 millis = 13542875; seconds = 13542 Thanks, Mark _______________________________________________ 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... I am looking for a function that behaves like the Win32 GetTickCount function. I have tried mach_absolute_time , Microseconds and UpTime but they all have the same problem, they don't increment while the machine is asleep. int main (int argc, const char * argv[]) { kern_return_t err; mach_timebase_info_data_t info; uint32_t millis, seconds; char outputStr[64]; if ((err = mach_timebase_info(&info)) != KERN_SUCCESS) { return 1; } while (TRUE) { millis = (uint32_t)((mach_absolute_time() * (uint64_t)info.numer / (uint64_t)info.denom) / 1000000); seconds = millis / 1000; sprintf(outputStr, "millis = %u; seconds = %u\n", millis, seconds); fprintf(stdout, outputStr); fflush(stdout); sleep(2); } return 0; } While it is running put the Mac to sleep, wait a while and then wake it up and you will see no gap in the times reported. Does anyone know of a timing call that will account for time the machine has been asleep? This email sent to site_archiver@lists.apple.com