[Glass] DateAndTime ... all pretty strange

Dale Henrichs via Glass glass at lists.gemtalksystems.com
Wed Jan 11 15:26:19 PST 2017


I agree that what you are seeing is "pretty strange", but I am not able 
to reproduce your results.

The #fromString implementation uses a ScaledDecimal instance for the 
express purpose of preserving the number decimal points so that the 
#printString and #fromString: results match ...

If I run as SystemUser, where the #fromString: does not use a 
ScaledDecimal, the number of decimal places is not preserved, but in my 

   topaz 1> run
   (DateAndTime fromString: '2017-01-11T20:37:32.28995+01:00') printString

   topaz 1> run
   (DateAndTime fromString: '2017-01-11T20:37:32.28995+01:00') printString

But these results are consistent with using converting the seconds to a 
Float ....

So I don't see the truncation of seconds that you see with this expression:

   (DateAndTime fromString: '2017-01-11T20:37:32.289+01:00') 
printString  -> '2017-01-11T20:37:32+01:00'

and I don't see truncation of seconds plus time zone skew in these results:

   (DateAndTime fromString: '2017-01-11T20:37:32.28995+01:00') 
printString -> '2017-01-11T20:37:32+03:00'

So I'm not exactly sure how to proceed ...

If you were seeing consistent time zone skew, I would suspect that the 
GemStone stone's timezone and the timezone of your machine might 
disagree (by default GemStone assumes PST/PDT), but given the fact that 
you seem to be getting random generation of the UTC offset it is hard to 
come up with a rational explanation ...

... Just a second, If I use #printStringRoundedSeconds, I do see results 
similar to what you are reporting:

   (DateAndTime fromString: '2017-01-11T20:37:32.289+01:00') 
printStringWithRoundedSeconds -> '2017-01-11T20:37:32+01:00'

but again, I am not seeing inconsistent results ... 
#printStringWithRoundedSeconds always rounds ... and I can't explain the 
random transformation of the UTC offset.


On 1/11/17 11:54 AM, Marten Feldtmann via Glass wrote:
> If I execute "DateAndTime now printString" I get (e.g.) 
> '2017-01-11T20:37:32.28995895385742+01:00', which looks pretty ok. 
> It's a little bit strange about the many digits in the fractional part 
> of seconds - but it seems, that this is allowed.
> If you give this string to e.g. Python it will throw an exception 
> (e.g. via json) - due to the many digits. For this purposes you have 
> to cut the number of digits to about 3 to 5 - then its work.
> Now try the reverse with "(DateAndTime fromString: 
> '2017-01-11T20:37:32.28995895385742+01:00') printString" and you get: 
> "'2017-01-11T20:37:32+06:00'". That feels very strange ......
> Some other tests:
> (DateAndTime fromString: '2017-01-11T20:37:32.289+01:00') printString  
> -> '2017-01-11T20:37:32+01:00'
> (DateAndTime fromString: '2017-01-11T20:37:32.28995+01:00') 
> printString -> '2017-01-11T20:37:32+03:00'
> For me this seems to be badly broken (Gemstone/S 3.3.3) ... any other 
> solution in Gemstone to parse more difficult DateTime stuff ???
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20170111/9481f6e0/attachment.html>

More information about the Glass mailing list