switch GPeriodic to use monotonic time

This commit is contained in:
Ryan Lortie 2010-10-22 19:13:01 +02:00
parent 91113a8aee
commit d3fe2efb83

View File

@ -114,13 +114,13 @@ static guint64
g_periodic_get_microticks (GPeriodic *periodic) g_periodic_get_microticks (GPeriodic *periodic)
{ {
guint64 microticks; guint64 microticks;
GTimeVal timeval; GTimeSpec timespec;
g_source_get_current_time (periodic->source, &timeval); g_source_get_time (periodic->source, &timespec);
microticks = timeval.tv_sec; microticks = timespec.tv_sec;
microticks *= 1000000; microticks *= 1000000;
microticks += timeval.tv_usec; microticks += timespec.tv_nsec / 1000;
microticks *= periodic->hz; microticks *= periodic->hz;
return microticks; return microticks;