On Mon, Aug 25, 2008 at 10:47:44AM +0200, Martin Mares wrote:
I would very much like to avoid including anything in asm/... and especially using HZ. The proper way to get HZ is to call sysconf(_SC_CLK_TCK). This should be portable to all POSIX systems.
I supposed this variant to be linux 2.4 specific workaround and clock_gettime() to be the portable one. The code has more linux-specific assumtions (like that time_t is 32bit integer).
Anyway, is there any problem in using time() as previously, but detect timewarps?
There are two ways to do it - the first one keeps 'now' variable monotonic (using time() and detecting timewarps), the second keeps current time in 'now' variable and fixes its users (like event loop) to not suppose monotonicity. IMHO the first way does not have any advantages, 'now' variable wouldn't have no well defined meaning, the second way is unnecessary hard. Although later i found that some parts of bird suppose that 'now' contains real time (some user outputs printing and password validity check) i think it is more easy to fix these. For example when route appears, it gets timestamp that is printed using 'show route'. Timestamp might be relative monotonic time and during print i can compute the time of route appearance by using current time() and offset between monotonic timers. This will show correct time even when system tiwe was broken during route appearance. -- Elen sila lumenn' omentielvo Ondrej 'SanTiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
participants (1)
-
Ondrej Zajicek