-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Hi,
On 10/16/12 5:44 PM, Maxim Sobolev wrote: > Author: sobomax Date: Wed Oct 17 00:44:34 2012 New Revision: > 241625 URL: http://svn.freebsd.org/changeset/base/241625 > > Log: o Use nanosleep(2) to sleep exact amount of time till the next > second, not multiple of 1 second, which results in actual time to > drift back and forth every run within 1 second of the actual action > has been set for. > > Suggested by: Ian Lepore > > o Schedule the first run in 1 second after starting up, not on the > boundary of the next minute, which results in the every_second > jobs not being run. > > for (;;) { - seconds_to_wait = (int) (TargetTime - > time((time_t*)0)); + gettimeofday(&ctime, NULL); Could you please replace this with clock_gettime(CLOCK_REALTIME_FAST)? This also gives us time in timespec, suitable for use with nanosleep, plus save some code for the subtract helper. -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJQfmkBAAoJEG80Jeu8UPuz1QgH/2YALytmL6l6cTwzku7MqMjV 7JlYyje1GCJ5fnUUxyEl19ZSeHExGXCi8UWLHAvR3Y8uDqZ+NBY3iDRckKexbbfZ fWJhmrDUeon1i9BG4nYSWZQ/M2XvEAfr31hNgH7aEHVI81KBxaStBNi11HEQsR70 gdSBAdkB/SVgD76FgTuwPChcusJhf5egv28K6yWPUyzR2x3berS2h3eAmj1I1CDo buDi9HUQCSSrFSHNeKawPq9iOGkuDs/yvAUd1e+OWXPtD+RWBhuqIi0U141w6yRy hEE3wWUTjChg9e4r9oCsUx5tKPeNXbV136txj8LVZKahfOxyRF/Ac4H7C/6pFpI= =HdF2 -----END PGP SIGNATURE----- _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"