<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 28 October 2017 at 04:52, Paul Wouters <span dir="ltr"><<a href="mailto:paul@nohats.ca" target="_blank">paul@nohats.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On Fri, 27 Oct 2017, Andrew Cagney wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I noticed that the timestamp added to log files has only a 1 second resolution; this isn't much help when multiple<br>
events get processed per second.  The reason is a combination time() (1 second resolution) and strftime() (doesn't<br>
do sub-second resolution anyway).  I suspect all this pre-dates git history.<br>
</blockquote>
<br></span>
Yes.<span class="gmail-"><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Anyway, I'm looking at an alternative.  My thought is a combination of  gettimeofday() or<br>
event_base_gettimeofday_cached<wbr>() (the latter would peg our times to when the event fired I believe which may not<br>
be such a good idea, otoh it is cheap) and strftime() + printf().  Any thoughts.<br>
</blockquote>
<br></span>
No specific advise from me here. Antony might know more about libevent<br>
and using it for timers?<span class="gmail-"><br>
<br></span></blockquote><div><br></div><div>I've pushed the first change.<br></div><div><br></div><div>struct timeval's getimeofday(2) claims that POSIX recommends struct timespec's clock_gettime(2).  However, libevent uses struct timeval and struct timespec lacks anything like timeradd(3) <a href="http://et.al">et.al</a>. so I went with the former.</div><div><br></div>I think, because event_base_gettimeofday_cached() doesn't change, it would make for confusing logs.<br><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
PS: I'm also left wondering why delta time isn't a double, would make specifying sub-second timers a lot easier<br>
(i.e., 0.5)<br>
</blockquote>
<br></span>
I'm mostly left with a feeling time is overengineered and overly complex<br>
in our code - even if it is theorectically the most correct :P<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br></blockquote></blockquote><div><br></div><div>Once some code was cleaned up, changing realtime_t's implementation was straight forward so that does seem to work.</div><div><br></div><div>However, deltatime_t seems to be another story.  I'm going to up its precision but note that a lot of code just flips it to time_t and uses that.</div><div>As for monotime_t I don't know what it is trying to do so I'll ignore it; perhaps clock_gettime(CLOCK_MONOTONIC)?</div><div><br></div><div>Andrew<br></div></div><br></div></div>