<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Hi All,<br></div><div><br>On Jul 7, 2016, at 9:33 AM, Eliot Miranda &lt;<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Hi All,<div><br></div><div>&nbsp; &nbsp; how does one produce a nice timestamp, simply date and time as in</div><div><br></div><div><div>&nbsp; &nbsp; 7/7/2016 09:19:38</div><div><br></div><div>Trivial, right?</div><div><br></div><div>So</div><div><div><br></div><div>&nbsp; &nbsp; Date today mmddyyyy, ' ', Time now print24 '7/7/2016 09:22:40.914'</div></div><div><br></div><div>.914, ah, nanos.&nbsp; How useful.&nbsp; Let's get rid of them.&nbsp; No nanos: accessor so</div><div><br></div><div>&nbsp; &nbsp; Date today mmddyyyy, ' ', (Time now nanos: 0) print24 =&gt; MNU</div><div><br></div><div>but there's a seconds accessor, so</div><div><br></div><div>&nbsp; &nbsp;&nbsp;Date today mmddyyyy, ' ', (Time now seconds: Time now seconds; print24) '7/7/2016 00:00:41</div><div><br></div><div>??&nbsp; So seconds: is private, and isn't the dual of Time seconds:</div><div><br></div><div><div>Time seconds</div><div><span class="" style="white-space:pre">        </span>^ self second</div></div><div><div>Time second</div><div><span class="" style="white-space:pre">        </span>^ self asDuration seconds</div></div><div><div>Duration seconds</div><div><span class="" style="white-space:pre">        </span>"Answer the number of seconds the receiver represents."</div><div><span class="" style="white-space:pre">        </span>^seconds rem: SecondsInMinute</div></div><div><br></div><div>Looks broken to me.</div></div></div></div></blockquote><div><br></div>Let me be more explicit, and ask for permission to fix this. &nbsp;One basic bug is the asymmetry between seconds, an accessor that answers seconds mod 60, and seconds: that doesn't set seconds mod 60. &nbsp;But&nbsp;<span style="background-color: rgba(255, 255, 255, 0);">seconds: is private and could be replaced by eg setTotalSeconds:, presumably without breaking clients, allowing&nbsp;seconds: to be redefined to do the right thing.</span><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">I note that the historic bug of changing the semantics of Time now to answer something with finer resolution than one second could have been avoided by adding eg exactlyNow or preciselyNow.</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">The problem with nanos (apart from the horrible abbreviation) is that it presumes a maximum precision that isn't well chosen. &nbsp;Microseconds work out much better. &nbsp;And I hope we change the internal representation accordingly. &nbsp;But there needs to be done accessor that rounds to the nearest second without revealing the internal precision. &nbsp;Time now toTheNearestSecond or&nbsp;Time theNearestSecondNow or...?</span></div><div><br><blockquote type="cite"><div><div dir="ltr"><div><div><br></div><div>Personally I think print24 should not print sub seconds.</div><div><br></div><div>cc'ing to Pharo because I want this timestamp to be the same in both dialects for a profiling tool we want to use in both dialects.</div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best,&nbsp;Eliot</div></span></div></div></div>
</div></div>
</div></blockquote></div></body></html>