[squeak-dev] Unix Time

Levente Uzonyi leves at elte.hu
Fri Jan 15 20:37:45 UTC 2010


On Fri, 15 Jan 2010, Bert Freudenberg wrote:

> 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).
>

Great, thanks. DateAndTimeTest >> #testReadFrom is failing now, because it 
assumes that offset will be zero, which is okay according to the comment 
in String >> #asDateAndTime which says: "Convert from UTC format".


Levente

> 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