Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] date manipulation library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-09-15 (23:29)
From: Julien Signoles <Julien.Signoles@l...>
Subject: Re: [Caml-list] date manipulation library
On Mon, 15 Sep 2003, Stefano Zacchiroli wrote:

> I'm interested in releasing a debian package of it, if it's ok for you.

ok for me.

> 1) why the timezone setting is global? It's really a non functional
>    approach and it turns out to be very annoying.
>    I would rather prefer to have an optional timezone attached to both
>    time and dates. This could be reflected in an optional parameter of
>    date/time constructors and in destructors to fetch timezones raising
>    exceptions when it's undefined.

Yes, it is an imperative approach. I think you mostly set the time zone
once at the beginning of your program: you don't change the time zone
while you're computing some values. Sometimes, you may want to convert a
time from a time zone to another one and I produce some converters to do
that. So, my philosophy is:
(1) set the time zone globaly: easier use of times and dates
(an optional parameter is ok... if the default value is as you wish ;).
(2) change the time zone localy if you need (use the converters).

> 2) often user defined pretty printing is needed for time/dates. What
>    about adding more pretty printing functions in addition to the
>    already provided to_string? Implementing a generic pretty printing
>    format which use the "date" unix command format will be fantastic for
>    unix gurus. Just to start a generic destructor function will be
>    great.

Yes, great idea. It is now in my TODO list :).

> - the library isn't on the humps, am I wrong?

You're right (but not my responsibility).

> - there's a wonderful typo (look at the day) :-))))
>         (* Return [true] if a date is a leap day
>          (i.e. February, 24th of a leap year); [false] otherwise. *)
>       val is_leap_day : t -> bool

Not a typo !!! :o))) And the implementation of [is_leap_day] follows this

The justification comes from the calendar FAQ

2.3. What day is the leap day?

It is 24 February!

Weird? Yes! The explanation is related to the Roman calendar and is
found in section 2.7.1.

>From a numerical point of view, of course 29 February is the extra
day. But from the point of view of celebration of feast days, the
following correspondence between days in leap years and non-leap
years has traditionally been used:

        Non-leap year           Leap year
        -------------           ----------
        22 February             22 February
        23 February             23 February
                                24 February (extra day)
        24 February             25 February
        25 February             26 February
        26 February             27 February
        27 February             28 February
        28 February             29 February

For example, the feast of St. Leander has been celebrated on 27
February in non-leap years and on 28 February in leap years.

Julien Signoles
-- ;
"In theory, practice and theory are the same,
but in practice they are different" (Larry McVoy)

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: