Am 22.05.2014 00:14, schrieb Richard Hansen: > On 2014-05-20 15:11, Karsten Blees wrote: >> Add a getnanotime() function that returns nanoseconds since 01/01/1970 as >> unsigned 64-bit integer (i.e. overflows in july 2554). > > Must it be relative to epoch? If it was relative to system boot (like > the NetBSD kernel's nanouptime() function), then you wouldn't have to > worry about clock adjustments messing with performance stats and you > might have more options for implementing getnanotime() on various platforms. > > -Richard > Normalizing to the epoch adds the ability to use the same timestamps (div 10e9) in other time-related functions (e.g. gmtime, ctime etc.), with very little overhead (one 64-bit integer addition per call). The getnanotime() implementation is actually platform independent and can be backed by any time source that returns nanoseconds relative to anything. Getnanotime() is synced to the system clock only once on startup, so if your time source is monotonic (which I think NetBSD's nanouptime() is), you don't have to worry about clock adjustments. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html