<HTML xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<HEAD><!-- Template generated by Exclaimer Mail Disclaimers on 08:41:11 Wednesday, 3 October 2012 -->
<STYLE type=text/css>P.bc7bcf41-2394-498f-be6c-d75b8cdba446 {
MARGIN: 0cm 0cm 0pt
}
LI.bc7bcf41-2394-498f-be6c-d75b8cdba446 {
MARGIN: 0cm 0cm 0pt
}
DIV.bc7bcf41-2394-498f-be6c-d75b8cdba446 {
MARGIN: 0cm 0cm 0pt
}
TABLE.bc7bcf41-2394-498f-be6c-d75b8cdba446Table {
MARGIN: 0cm 0cm 0pt
}
DIV.Section1 {
page: Section1
}
</STYLE>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Generator" content="Microsoft Word 14 (filtered medium)" />
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</HEAD>
<BODY lang="EN-US" link="blue" vlink="purple">
<P class=bc7bcf41-2394-498f-be6c-d75b8cdba446>
<div class="WordSection1">
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>Hi Arnaud,<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>I see, however I think that it’s actually better to do the encapsulation.<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>Justification:<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>1/ We need to alter widespread code, anyway<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>(I mean if we used clock_gettime already and just needed to implement it<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>for platforms that don’t have it, using the autoconf macro would be nice<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>and fast way to do it, but since we don’t, well, see point 2 and 3)<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>2/ Having our own interface provides more flexibility<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>(The implementation may actually not be really straightforward)<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>3/ We don’t mind performance loss on wrappers<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>(Not that it would be that great)<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>But of course, I can just implement clock_gettime; however, I already have<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>the new module written, so I’d rather continue in this direction, if you don’t<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>insist on it...<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>Note that I’m still on my branch so no harm done. ;-)<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>vaclav<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
</div></div></div></P>
<P class=bc7bcf41-2394-498f-be6c-d75b8cdba446> </P>
<P class=bc7bcf41-2394-498f-be6c-d75b8cdba446>
<HR id=HR1 />
Eaton Elektrotechnika s.r.o. ~ S�dlo spolecnosti, jak je zaps�no v rejstr�ku: Kom�rovsk� 2406, Praha 9 - Horn� Pocernice, 193 00, Cesk� Republika ~ Jm�no, m�sto, kde byla spolecnost zaregistrov�na: Praha ~ Identifikacn� c�slo (ICO): 498 11 894
<P class=bc7bcf41-2394-498f-be6c-d75b8cdba446>
<HR id=HR1 />
<P></P>
<P class=bc7bcf41-2394-498f-be6c-d75b8cdba446> </P>
<P class=bc7bcf41-2394-498f-be6c-d75b8cdba446><div class="WordSection1"><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"> Arnaud Quette [mailto:aquette.dev@gmail.com]
<br />
<b>Sent:</b> Wednesday, October 03, 2012 2:00 PM<br />
<b>To:</b> Krpec, Vaclav<br />
<b>Cc:</b> baruch@ev-en.org; nut-upsdev@lists.alioth.debian.org; clepple@gmail.com; baruch@debian.org<br />
<b>Subject:</b> Re: [Nut-upsdev] NUT Bugs #313634 & #313714: unification & encapsulation of timer proposition<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">2012/10/2 <<a href="mailto:VaclavKrpec@eaton.com" target="_blank">VaclavKrpec@eaton.com</a>><o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>Hello Baruch,</span><o:p></o:p></p>
<p class="MsoNormal" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D> </span><o:p></o:p></p>
<p class="MsoNormal" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>thanks for your comment.</span><o:p></o:p></p>
<p class="MsoNormal" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto><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</span><o:p></o:p></p>
<p class="MsoNormal" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>portable clock with the possibility of monotonic/ real-time</span><o:p></o:p></p>
<p class="MsoNormal" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>operation (where available).</span><o:p></o:p></p>
<p class="MsoNormal" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>It still should be encapsulated, though. Unlike time() and</span><o:p></o:p></p>
<p class="MsoNormal" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>difftime(), clock_*time() interface (or at least the monotonic</span><o:p></o:p></p>
<p class="MsoNormal" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>clock back-end) is not available everywhere.</span><o:p></o:p></p>
<p class="MsoNormal" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>If we want real portability, we need our own opaque type</span><o:p></o:p></p>
<p class="MsoNormal" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D>and encapsulation of the implementation.</span><o:p></o:p></p>
<p class="MsoNormal" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto><span style=font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D> </span><o:p></o:p></p>
<p class="MsoNormal" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto><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...</span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><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><o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<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" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto><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</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto> <o:p></o:p></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.<o:p></o:p></p>
<p>This will also serve to explain the real intention of a monotonic clock and not just a plain timer.<o:p></o:p></p>
<p>My 2¢<o:p></o:p></p>
<p>Baruch<o:p></o:p></p>
<div>
<p class="MsoNormal" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto>On Sep 27, 2012 1:19 PM, <<a href="mailto:VaclavKrpec@eaton.com" target="_blank">VaclavKrpec@eaton.com</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal" style=mso-margin-top-alt:auto;mso-margin-bottom-alt:auto>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><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
<p><o:p> </o:p></p>
</div>
</blockquote>
</div>
</div>
</div>
</P></P></P></BODY>
</HTML>