[Swan-dev] hi resolution time in log file

Paul Wouters paul at nohats.ca
Sat Oct 28 08:52:10 UTC 2017


On Fri, 27 Oct 2017, Andrew Cagney wrote:

> I noticed that the timestamp added to log files has only a 1 second resolution; this isn't much help when multiple
> events get processed per second.  The reason is a combination time() (1 second resolution) and strftime() (doesn't
> do sub-second resolution anyway).  I suspect all this pre-dates git history.

Yes.

> Anyway, I'm looking at an alternative.  My thought is a combination of  gettimeofday() or
> event_base_gettimeofday_cached() (the latter would peg our times to when the event fired I believe which may not
> be such a good idea, otoh it is cheap) and strftime() + printf().  Any thoughts.

No specific advise from me here. Antony might know more about libevent
and using it for timers?

> PS: I'm also left wondering why delta time isn't a double, would make specifying sub-second timers a lot easier
> (i.e., 0.5)

I'm mostly left with a feeling time is overengineered and overly complex
in our code - even if it is theorectically the most correct :P

Paul
> 
>


More information about the Swan-dev mailing list