Date and Time libraries in various languages

By: on May 5, 2006

Can a correct, or even sensible Date, Time and Calendar library be designed, for any programming language at all, ever, by anybody, genius, time expert, or not? Certainly [old link: ] Java’s Date API isn’t very inspiring, but some systems do manage to do better: here’s a quick survey of the state of Date/Time/Calendar libraries in a few different languages.

* Scheme’s SRFI 19 is, overall, an excellent library at its core (i.e. the specification of Time objects), but suffers from a number of bugs in its reference implementation, some quite serious, and lacks support for the timezone database.

* Things may be looking up for Time processing in Java: the Joda Time library looks like it’s designed around the key separation of Instants, Intervals, and Durations from Calendar-related notions such as Dates, Times, and human-readable representations of time. The evidence suggests it may even deal with timezones properly.

* Even C’s venerable time implementation (it’s an int! Everything’s an int!) is better than that provided by many languages. At least it’s correct and reasonably simple. The main flaw in it is the way that the current timezone is not even a global variable – it’s an environment variable. Trying to treat it as a parameter is an exercise in frustration, making timezone calculations far, far more difficult than they need to be.

* Squeak currently has two major libraries: Chronology, the incumbent, and the comprehensive-looking newcomer Chronos. I’ve only ever used Chronology, but I can definitely say it was a very pleasant experience compared to every other language and date/time library I’ve ever used. Chronology doesn’t really do timezones (or leap seconds), and from that point of view Chronos is a significant improvement. Chronos looks very promising, but loading it broke my image (timestamping doits broke during save and quit) so I’ve not explored it in any detail.



  1. Jeremy says:

    See also (Common Lisp).

  2. Alan Lovejoy says:

    From your description of your experience with Chronos in Squeak, it appears you have loaded the version on SqueakSource. That version is the very, very preliminary port of Chronos to Squeak done by Avi Bryant. It has many problems–as explained in this blog post:

    But there is a much newer version of Chronos available for Squeak, which doesn’t have the problems that were in Avi’s initial port. You can dowload it from the Chronos web site.


  3. tonyg says:

    Thank you, Alan, I’ll give it a try.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>