<br><div class="gmail_quote">2012/10/2  <span dir="ltr"><<a href="mailto:VaclavKrpec@eaton.com" target="_blank">VaclavKrpec@eaton.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">









<div link="blue" vlink="purple" lang="EN-US">
<p>
</p><div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hello Baruch,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">thanks for your comment.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">OK, I’ll just aim to create an implementation of all-purpose<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">portable clock with the possibility of monotonic/ real-time<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">operation (where available).<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">It still should be encapsulated, though.  Unlike time() and<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">difftime(), clock_*time() interface (or at least the monotonic<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">clock back-end) is not available everywhere.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">If we want real portability, we need our own opaque type<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">and encapsulation of the implementation.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I guess I’ll just code a proposition and we shall se...<u></u><u></u></span></p>
</div></div></blockquote><div><br>another variation is to standardize on clock_gettime() / clockid_t, and to use AC_REPLACE_FUNC to provide it from NUT, if it's not avail. on the system.<br> <br>tell me back if you need some guidance to check this variation.<br>
<br>cheers,<br>Arnaud<br>-- <br>Linux / Unix / Opensource Engineering Expert - Eaton - <a href="http://opensource.eaton.com" target="_blank">http://opensource.eaton.com</a><br>Network UPS Tools (NUT) Project Leader - <a href="http://www.networkupstools.org" target="_blank">http://www.networkupstools.org</a><br>
Debian Developer - <a href="http://www.debian.org" target="_blank">http://www.debian.org</a><br>Free Software Developer - <a href="http://arnaud.quette.fr" target="_blank">http://arnaud.quette.fr</a><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US"><div>

<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
</div></div></div><p></p>
<p></p><p></p><div><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"><div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Baruch Even [mailto:<a href="mailto:baruch@ev-en.org" target="_blank">baruch@ev-en.org</a>]
<br>
<b>Sent:</b> Thursday, September 27, 2012 2:26 PM<br>
<b>To:</b> Krpec, Vaclav<br>
<b>Cc:</b> <a href="mailto:aquette.dev@gmail.com" target="_blank">aquette.dev@gmail.com</a>; <a href="mailto:nut-upsdev@lists.alioth.debian.org" target="_blank">nut-upsdev@lists.alioth.debian.org</a>; <a href="mailto:clepple@gmail.com" target="_blank">clepple@gmail.com</a>; <a href="mailto:baruch@debian.org" target="_blank">baruch@debian.org</a><br>

<b>Subject:</b> Re: [Nut-upsdev] NUT Bugs #313634 & #313714: unification & encapsulation of timer proposition<u></u><u></u></span></p>
</div>
</div><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<p>My opinion on this is that it might be a little too abstract. I'd go with what I essentially started which is to abstract just a monotonic clock with only what is needed. If the platform doesn't have a monitonic clock than it can be apprixmated.<u></u><u></u></p>

<p>This will also serve to explain the real intention of a monotonic clock and not just a plain timer.<u></u><u></u></p>
<p>My 2¢<u></u><u></u></p>
<p>Baruch<u></u><u></u></p>
<div>
<p class="MsoNormal">On Sep 27, 2012 1:19 PM, <<a href="mailto:VaclavKrpec@eaton.com" target="_blank">VaclavKrpec@eaton.com</a>> wrote:<u></u><u></u></p>
<p class="MsoNormal">Hello everybody,<br>
<br>
I'm working on the "Use difftime for time comparison" bug (#313634).<br>
Charles directed me to the other one "Use monotonic clock for monitoring"<br>
attended to by Baruch; I believe that's very good idea, however I'd use a bit<br>
more encapsulated & general approach:<br>
<br>
1/ I'd create an opaque timer type and its get/set/cmp/inc/dec etc interface<br>
under common<br>
2/ implementation of the interface would use the monotonic clock if available<br>
(the clock_*time on Linux, potentially other monotonic clock impl. on other<br>
systems) and time_t as a fallback<br>
3/ when implemented, use of the timer shall be spread throughout the code,<br>
replacing direct use of time_t<br>
<br>
What do you think?<br>
I'm also a bit reluptant to do such a change in scope of the bugfix; I'd create<br>
a new feature req. for that, OK?<br>
<br>
Any comments/ suggestions welcome,<br>
<br>
Regards,<br>
<br>
Vaclav<br>
<br>
P.S: already managed to post this from another address by mistake, so please<br>
just discard the previous e-mail (or this one, depending on which you've read).<br>
<br>
--<br>
Václav Krpec<br>
Software Developer<br>
Network UPS Tools project<br>
Eaton Opensource Team<br>
Eaton European Innovation Center<br>
<br>
<br>
<br>
<br>
-----------------------------<br>
Eaton Elektrotechnika s.r.o. ~ S<span style="font-family:"Tahoma","sans-serif"">�</span>dlo spolecnosti, jak je zaps<span style="font-family:"Tahoma","sans-serif"">�</span>no v rejstr<span style="font-family:"Tahoma","sans-serif"">�</span>ku: Kom<span style="font-family:"Tahoma","sans-serif"">�</span>rovsk<span style="font-family:"Tahoma","sans-serif"">�</span>
 2406, Praha 9 - Horn<span style="font-family:"Tahoma","sans-serif"">�</span> Pocernice, 193 00, Cesk<span style="font-family:"Tahoma","sans-serif"">�</span> Republika ~ Jm<span style="font-family:"Tahoma","sans-serif"">�</span>no, m<span style="font-family:"Tahoma","sans-serif"">�</span>sto,
 kde byla spolecnost zaregistrov<span style="font-family:"Tahoma","sans-serif"">�</span>na: Praha ~ Identifikacn<span style="font-family:"Tahoma","sans-serif"">�</span> c<span style="font-family:"Tahoma","sans-serif"">�</span>slo (ICO): 498 11 894<br>

-----------------------------<br>
<br>
<br>
_______________________________________________<br>
Nut-upsdev mailing list<br>
<a href="mailto:Nut-upsdev@lists.alioth.debian.org" target="_blank">Nut-upsdev@lists.alioth.debian.org</a><br>
<a href="http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsdev" target="_blank">http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsdev</a><u></u><u></u></p>
</div>
</div></div></div>
</div>
<p></p><p></p><p><br></p></div>


</blockquote></div>