About Unix time, TimeStamp, ZTimestamp, and GLORP
I'm getting the following this Unix time from a REST API: Unix Time: 1387243991 Which is the following GMT: Tue, 17 Dec 2013 01:33:11 GMT And localized: 12/16/2013 22:33:11 GMT-3 So far, so good. If I parse it with ZTimestamp it parses properly (kudos svc): (ZTimestamp fromUnixTime: 1387243991) "prints ->" 2013-12-17T01:33:11Z. But if I parse it with TimeStamp it gives me totally weird output: (TimeStamp fromUnixTime: 1387243991) "prints ->" 16 December 2013 12:0-26:0-49 am Until here it seems to be a matter of printing, the underlying seconds remain untouched. But then when mapped to a timestamp column without timezone with GLORP (PostgreSQL) I'm getting this stored in the database: '2013-12-16 17:33:11' Which once read again by GLORP get's converted to: 16 December 2013 12:0-26:0-49 am (Which asZTimestamp is '2013-12-16T09:33:11Z'). Any help here? If it was my choice, I would only use ZTimestamp, and display localized every time I need. But I don't know if there is a way to map a ZTimestamp to a TZ column in GLORP. Anybody did the "converter" already? Regards, Esteban A. Maringolo
Nevermind. I had a wrong time zone for my new development environment in Ubuntu 13.10 (I migrated from Win7). I did change the time zone of the Ubuntu machine AND also the PostgreSQL database, but I didn't restart Pharo. Once Pharo was restarted, everything got in sync again. Being 23:50 (local time) It's time to rest. :) Best regards, Esteban A. Maringolo 2013/12/16 Esteban A. Maringolo <emaringolo@gmail.com>:
I'm getting the following this Unix time from a REST API:
Unix Time: 1387243991 Which is the following GMT: Tue, 17 Dec 2013 01:33:11 GMT And localized: 12/16/2013 22:33:11 GMT-3
So far, so good.
If I parse it with ZTimestamp it parses properly (kudos svc): (ZTimestamp fromUnixTime: 1387243991) "prints ->" 2013-12-17T01:33:11Z.
But if I parse it with TimeStamp it gives me totally weird output: (TimeStamp fromUnixTime: 1387243991) "prints ->" 16 December 2013 12:0-26:0-49 am
Until here it seems to be a matter of printing, the underlying seconds remain untouched.
But then when mapped to a timestamp column without timezone with GLORP (PostgreSQL) I'm getting this stored in the database: '2013-12-16 17:33:11'
Which once read again by GLORP get's converted to: 16 December 2013 12:0-26:0-49 am (Which asZTimestamp is '2013-12-16T09:33:11Z').
Any help here?
If it was my choice, I would only use ZTimestamp, and display localized every time I need. But I don't know if there is a way to map a ZTimestamp to a TZ column in GLORP. Anybody did the "converter" already?
Regards,
Esteban A. Maringolo
This still puzzles me though: (TimeStamp fromUnixTime: 1387243991) "Ctrl+P" '16 December 2013 12:0-26:0-49 am' Esteban A. Maringolo
On 17 Dec 2013, at 03:53, Esteban A. Maringolo <emaringolo@gmail.com> wrote:
This still puzzles me though:
(TimeStamp fromUnixTime: 1387243991) "Ctrl+P" '16 December 2013 12:0-26:0-49 am'
Esteban A. Maringolo
I do not get the strange output, with or without the asUTC. (TimeStamp fromUnixTime: 1387243991) asUTC => "17 December 2013 1:33:11 amâ Sven
participants (2)
-
Esteban A. Maringolo -
Sven Van Caekenberghe