[squeak-dev] Re: Time now print24
marcel.taeumel
Marcel.Taeumel at hpi.de
Fri Jul 8 06:43:41 UTC 2016
Eliot Miranda-2 wrote
> Hi All,
>
>> On Jul 7, 2016, at 9:33 AM, Eliot Miranda <
> eliot.miranda@
> > wrote:
>>
>> Hi All,
>>
>> how does one produce a nice timestamp, simply date and time as in
>>
>> 7/7/2016 09:19:38
>>
>> Trivial, right?
>>
>> So
>>
>> Date today mmddyyyy, ' ', Time now print24 '7/7/2016 09:22:40.914'
>>
>> .914, ah, nanos. How useful. Let's get rid of them. No nanos: accessor
>> so
>>
>> Date today mmddyyyy, ' ', (Time now nanos: 0) print24 => MNU
>>
>> but there's a seconds accessor, so
>>
>> Date today mmddyyyy, ' ', (Time now seconds: Time now seconds;
>> print24) '7/7/2016 00:00:41
>>
>> ?? So seconds: is private, and isn't the dual of Time seconds:
>>
>> Time seconds
>> ^ self second
>> Time second
>> ^ self asDuration seconds
>> Duration seconds
>> "Answer the number of seconds the receiver represents."
>> ^seconds rem: SecondsInMinute
>>
>> Looks broken to me.
>
> Let me be more explicit, and ask for permission to fix this. One basic
> bug is the asymmetry between seconds, an accessor that answers seconds mod
> 60, and seconds: that doesn't set seconds mod 60. But seconds: is private
> and could be replaced by eg setTotalSeconds:, presumably without breaking
> clients, allowing seconds: to be redefined to do the right thing.
>
> 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.
>
> The problem with nanos (apart from the horrible abbreviation) is that it
> presumes a maximum precision that isn't well chosen. Microseconds work
> out much better. And I hope we change the internal representation
> accordingly. But there needs to be done accessor that rounds to the
> nearest second without revealing the internal precision. Time now
> toTheNearestSecond or Time theNearestSecondNow or...?
>
>>
>> Personally I think print24 should not print sub seconds.
>>
>> 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.
>> _,,,^..^,,,_
>> best, Eliot
Hi Eliot,
please fix this. :-)
Best,
Marcel
--
View this message in context: http://forum.world.st/Time-now-print24-tp4905424p4905522.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.
More information about the Squeak-dev
mailing list
|