[squeak-dev] The Inbox: Kernel-cmm.669.mcz

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Sun Feb 5 22:00:52 UTC 2012


2012/2/4  <commits at source.squeak.org>:
> A new version of Kernel was added to project The Inbox:
> http://source.squeak.org/inbox/Kernel-cmm.669.mcz
>
> ==================== Summary ====================
>
> Name: Kernel-cmm.669
> Author: cmm
> Time: 3 February 2012, 5:55:11.175 pm
> UUID: 5ddec343-01ad-4e76-b32c-299fac68ec09
> Ancestors: Kernel-eem.668
>
> Introduced Timespan class>>defaultOffset.  This is the offset that will be used for creation of all Timespans when an offset is not specified.  When an offset is specified or involved in construction or calculation, the result is now produced in terms of the source offset.
>        For example, Date today now produces a globalized date by default.  However, "Date starting: (DateAndTime year: 2004 month: 2 day: 29 hour: 13 minute: 33 second: 0 offset: 2 hours)" produces a Date.whose start is expressed in terms of UTC+2.
>        The default defaultOffset is Duration zero so that Squeak will have fast, globalized Dates out of the box.  Globalized Dates are common for applications.
>        Legacy localized Dates can be obtained by evaluating "Date localize" so that, when an offset is not specified or otherwise involved in the input, the local offset will be used.
>
> =============== Diff against Kernel-eem.668 ===============
>
> Item was changed:
>  ----- Method: DateAndTime>>midnight (in category 'squeak protocol') -----
>  midnight
> +       "Answer a DateAndTime starting at midnight of the same timezone offset as the receiver."
> +       ^ self class basicNew
> -       "Answer a DateAndTime starting at midnight local time"
> -
> -       ^self class basicNew
>                setJdn: jdn
>                seconds: 0
>                nano: 0
> +               offset: offset!
> -               offset: self class localOffset
> - !
>

I like this one because

| dateAndTime |
dateAndTime := DateAndTime year: 2012 month: 1 day: 1 hour: 1 minute:
1 second: 1 offset: 10 hours.
self assert: (dateAndTime asDate includes: dateAndTime)

will succeed whatever your local time zone...


More information about the Squeak-dev mailing list