[squeak-dev] Unix Time

Bert Freudenberg bert at freudenbergs.de
Fri Jan 15 12:11:22 UTC 2010


On 15.01.2010, at 05:26, Mike Hales wrote:
> Is there any protocol in the DateAndTime hierarchy that returns the unix time? I want the equivalent of typing "date +%s" on the command line.

In the latest trunk image, there now is #asUnixTime :)

On 15.01.2010, at 12:16, Bert Freudenberg wrote:
> 
> http://tinlizzie.org/updates/etoys/updates/2092LocalePluginAddins-tpr.cs
> http://tinlizzie.org/updates/etoys/updates/2106chronologyUnix-bf.cs

I just committed these to trunk, with one modification to the startup - the timezone is set unconditionally (independent of useLocale).

The timezone is only set on startup. So restart the image or evaluate "Locale startUp: true".

before:

DateAndTime now
==> 2010-01-15T12:23:35.301+00:00

after:

DateAndTime now
==> 2010-01-15T12:24:02.452+01:00

(note the last four digits which are the local time offset)

DateAndTime now asUnixTime
==> 1263554652

- Bert -




More information about the Squeak-dev mailing list