Chronos is one of the many Smalltalk-related blogs syndicated on Planet Smalltalk
χρόνος

Discussion of the Essence# programming language, and related issues and technologies.

Blog Timezone: America/Los_Angeles [Winter: -0800 hhmm | Summer: -0700 hhmm] 
Your local time:  

2007-01-01

Version B1.184 of the Chronos Date/Time Library Published

Chronos Version B1.184 has been publised ("Beta Release 1--build 184".) Chronos B1.184 is available for VisualWorks, Squeak and Dolphin. The Chronos Seed Archive for B1.184 is also available (the "Chronos Seed" is the platform-independent Chronos codebase, used for porting Chronos from VisualWorks to other Smalltalk pltatforms.)

Chronos Version B1.184 can be obtained from the Chronos Web Site. The VisualWorks version can also be obtained from the Cincom Public StORE Repository, and the Squeak version can also be obtained from SqueakMap (as a .sar archive.) Note that the SqueakMapPackageLoader tool inexplicably fails to work with the Chronos.sar archive, although Chronos.sar can be dowloaded to your local machine over HTTP and then installed using the Squeak FileList.

You may also use the direct download link for VisualWorks, the direct download link for Squeak or the direct download link for Dolphin.

The Chronos Time Zone Repository is included in the download archive. Be sure to follow the Chronos Installation Instructions--especially if you have not already done so for a previous version of Chronos.

If you are reinstalling Chronos into an image in which an earlier version is already resident, and do not install the new version from the Cincom Public StORE Repository using StORE, it is necessary to first remove the earlier version. StORE has been able to correctly install the new version on top of every earlier version I have tried--but I haven't tried them all.

About Chronos Version B1.184


Chronos Version B1.184 makes a few small fixes and improvements, adds the capability to parse ScientificDurations from the textual representation required by the ANSI-Smalltalk standard, and adds the ability to parse CalendarDurations and CivilDurations from textual representations that conform to the ISO 8601 International Standard for the representation of date/time values.

Examples of parsing durational values:

    ScientificDuration readFromString: '-365:23:59:59'
    CalendarDuration readFromString: 'P48Y8M27.33D'
    CivilDuration readFromString: 'P48Y8M27DT18H16M55.062077S'
    Durational readFromString: 'P48Y8M27DT18H16M55.062077S'
    Durational readFromString: '-365:23:59:59'

"Durational readFromString:" can be used in situations where either the syntax specified by the ANSI Smalltalk Standard or the ISO 8601 syntax might be encountered.

The ISO 8601 syntax for durational values requires that years, months, days, hours, minutes and seconds must be representable as fractional values. For example, the ISO 8601 syntax for a duration of time that spans 5 quarters of a year is P1.25Y. It was therefore necessary to extend the functionality of Chronos durational values to support fractional years, months, days, hours, minutes and seconds, and it was then also necessary to extend the functionality of Chronos point-in-time values to support arithmetic using fractional years, months, days, hours, minutes and seconds. So Chronos version B1.184 now fully supports fractional duration element values, and the addition/subtraction of fractional years, months, days, hours, minutes and seconds.

The parsing of time intervals from their ISO 8601 syntax into instances of Timeperiod is now also supported (e.g., Timeperiod readFromString: '2002-03-01T13:00:00Z/2003-05-11T15:30:00Z'.)

A few convenience methods were added to CalendricalCoordinate:

    withDayOfYear:
    withMonth:
    withDayOfMonth:
    withMonth:day:

Along with the already-present methods #inYear:, #atStartOfDay, #atTimeOfDay:, #atTimeOfDay:in:, #nextDayOfWeek:, #prevDayOfWeek:, #tomorrow, #yesterday, #nextWeek, #prevWeek, #nextMonth, #prevMonth, #nextYear and #prevYear, these methods greatly simplify the task of constructing a new point-in-time value that differs only in some specified, but small, way from one you already have.

Examples (all of which are correct for any year in any calendar system):

To compute the first day of the next year:

    YearMonthDay today nextYear withDayOfYear: 1

To compute the date having the same day of the month as today, but in the last month of the year:

    YearMonthDay today withMonth: MonthOfYear lastMonthOfYear

To compute the date having the same year and month as today, but which is the last day of the month:

    YearMonthDay today withDayOfMonth: DayOfMonth lastDayOfMonth

To compute a date in the same year as today, but with any desired month/day-of-month designation:

    YearMonthDay today withMonth: 4 day: 15

Finally, the National Day of Mourning for US President Gerald Ford (2007-01-02) was added as a one-time NYSE closure to the list of non-trading days at the NYSE maintained by the "SemanticDatePolicy nyse" object.


No comments: