MINOR: time: add timeofday_as_iso_us() to return instant time as ISO
authorWilly Tarreau <w@1wt.eu>
Thu, 26 Sep 2019 06:00:23 +0000 (08:00 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 26 Sep 2019 06:13:38 +0000 (08:13 +0200)
commit93acfa2263a33a98f345b70edb61edef71062dec
treebcf2c1415e76ae5c2e907241e69188aca604712c
parent710d987cd62ab0779418f14aa2168dc10ef6bac7
MINOR: time: add timeofday_as_iso_us() to return instant time as ISO

We often need ISO time + microseconds in traces and ring buffers, thus
function does this by calling gettimeofday() and keeping a cached value
of the part representing the tv_sec value, and only rewrites the microsecond
part. The cache is per-thread so it's lockless and safe to use as-is.
Some tests already show that it's easy to see 3-4 events in a single
microsecond, thus it's likely that the nanosecond version will have to
be implemented as well. But certain comments on the net suggest that
some parsers are having trouble beyond microsecond, thus for now let's
stick to the microsecond only.
include/common/time.h
src/time.c