TimeStamp / StopWatch not monotonic?

Please post support and help requests here.
Posts: 1
Joined: 21 Aug 2009, 01:26

TimeStamp / StopWatch not monotonic?

Postby DarrenSargent » 21 Aug 2009, 01:31

I notice that the TimeStamp class uses gettimeofday for *NIX systems. There are known issues with this function...e.g. it can jump ahead, or go backwards, e.g. on systems with multiple cores, or running in VMs. Also it can get changed by ntpd, daylight savings, or if the admin just manually changes the time of day. It doesn't appear that this is monotonic at all, even though the Poco doc claims it is.

So, what's the scoop?

Also, any reason clock_gettime() wasn't used for *NIX implementations? This function appears to be POSIX-compliant and addresses some of the issues that gettimeofday has.

Posts: 1375
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: TimeStamp / StopWatch not monotonic?

Postby alex » 21 Aug 2009, 11:37

DarrenSargent wrote:So, what's the scoop?

You have a valid point here - clock_gettime() should have been used. The only thing I see as potential concern at this time is availability on all supported platforms.
Last edited by alex on 22 Aug 2009, 13:17, edited 1 time in total.

Posts: 1256
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: TimeStamp / StopWatch not monotonic?

Postby guenter » 22 Aug 2009, 10:12

clock_gettime() is unfortunately not available everywhere (e.g., its not available on OS X). The documentation for Timestamp should be changed to indicate that timestamps are only monotinic as long as the underlying system clock is monotonic. I also agree that Stopwatch should, for the stated reasons, not be based on Timestamp. Anyway, I have created a bug report on Sourceforge for this issue: https://sourceforge.net/tracker/?func=d ... tid=725709

Return to “Support”

Who is online

Users browsing this forum: No registered users and 1 guest