Hi Sven,
On Jul 7, 2016, at 9:47 AM, Sven Van Caekenberghe <sven@stfx.eu> wrote:
On 07 Jul 2016, at 18:33, Eliot Miranda <eliot.miranda@gmail.com> wrote:
Hi All,
how does one produce a nice timestamp, simply date and time as in
7/7/2016 09:19:38
Trivial, right?
I understand that you want it 'nice and clean', but the above is not precise (no TZ) and confusing (is it M/D/YYYY or D/M/YYYY ?).
Going more in the ISO direction is better (more universal), IMHO.
DateAndTime now rounded => "2016-07-07T18:45:12+02:00"
My use case is providing a human-readable time stamp on a benchmark output so something really simple is what's best and the full tu stamp you give above exactly opposite to what I want; verbose and hard to read.
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.
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