Subject: microtime going backwards
To: None <port-i386@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: port-i386
Date: 07/30/2002 18:45:59
I've added some diagnostics to the end of (my) microtime()
code to detect time travel.
microtime leapt back to 3d46cc10:44307 (+2457) from 3d46cc10:44326 (+2476)
microtime leapt back to 3d46cc9c:41be2 (+2442) from 3d46cc9c:41c06 (+2466)
microtime leapt back to 3d46cc9e:6ddcd (+270d) from 3d46cc9e:6ddfd (+2d)
microtime leapt back to 3d46ccb0:77669 (+2369) from 3d46ccb0:7768b (+238b)
microtime leapt back to 3d46ccb1:c22f (+25ef) from 3d46ccb1:c259 (+2619)
microtime leapt back to 3d46ccfb:731f6 (+606) from 3d46ccfb:73217 (+627)
microtime leapt back to 3d46cd23:89ca6 (+1126) from 3d46cd23:89cc5 (+1145)
microtime leapt back to 3d46cd23:8d9a1 (+1) from 3d46cd23:8d9d0 (+30)
microtime leapt back to 3d46cd2b:3088b (+225b) from 3d46cd2b:308aa (+227a)
microtime leapt back to 3d46cd2b:b93b7 (+2207) from 3d46cd2b:b93d7 (+2227)
microtime leapt back to 3d46cd41:2c1b0 (+290) from 3d46cd41:2c1ce (+2ae)
microtime leapt back to 3d46cd41:5e542 (+18e2) from 3d46cd41:5e561 (+1901)
microtime leapt back to 3d46cd42:6aeab (+1efb) from 3d46cd42:6aecb (+1f1b)
microtime leapt back to 3d46cdb4:72d1f (+12f) from 3d46cdb4:72d3d (+14d)
microtime leapt back to 3d46cdcf:e876e (+87e) from 3d46cdcf:e878a (+89a)
microtime leapt back to 3d46cdd0:be032 (+2062) from 3d46cdd0:be050 (+2080)
The values are 'seconds:usecs (+time that microtime added on)'.
My 'best guess' is that the errors happen when an interrupt is
lost. However I haven't traced the whether microtime() added
10000us because in interrupt was deferred.
(This ought to require that microtime be called with the timer
interrupt disabled.)
It is certainly possible to generate the errors my moving
mozilla windows around the screen.
David
--
David Laight: david@l8s.co.uk