caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Julien Signoles <Julien.Signoles@lri.fr>
To: Stefano Zacchiroli <zack@bononia.it>
Cc: caml-list@inria.fr, zack@debian.org,
	Julien Signoles <Julien.Signoles@lri.fr>
Subject: Re: [Caml-list] date manipulation library
Date: Tue, 16 Sep 2003 01:27:52 +0200 (MEST)	[thread overview]
Message-ID: <Pine.GSO.4.58.0309160026060.15139@lri> (raw)
In-Reply-To: <20030915183458.GA6577@fistandantilus.takhisis.org>

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

The justification comes from the calendar FAQ
(http://www.tondering.dk/claus/calendar.html):

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

Cheers,
Julien Signoles
-- 
mailto:Julien.Signoles@lri.fr ; http://www.lri.fr/~signoles
"In theory, practice and theory are the same,
but in practice they are different" (Larry McVoy)

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  parent reply	other threads:[~2003-09-15 23:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-15 14:37 Alan Schmitt
2003-09-15 14:48 ` Antoine Schweitzer-Chaput
2003-09-15 15:21 ` Xavier Leroy
2003-09-15 15:40   ` Alan Schmitt
2003-09-15 16:38   ` David Brown
2003-09-15 15:22 ` Julien Signoles
2003-09-15 18:34   ` Stefano Zacchiroli
2003-09-15 18:45     ` Maxence Guesdon
2003-09-15 23:27     ` Julien Signoles [this message]
2003-09-16  7:20       ` Stefano Zacchiroli
2003-09-16  7:32         ` Mattias Waldau
2003-09-16  8:29           ` Benjamin Geer
2003-09-16 18:21             ` [Caml-list] Will Emacs camldebug-mode need an update for 3.07? Mattias Waldau
2003-09-15 15:25 ` [Caml-list] date manipulation library Matthieu Sozeau
2003-09-17  7:57 ` Pierre Weis
2003-09-17  8:24   ` Mattias Waldau
2003-09-17 15:17     ` Pierre Weis
2003-09-19 14:48       ` [Caml-list] A plea for clear licenses (Was: date manipulation library) Florian Hars
2003-09-20 14:22         ` [Caml-list] " Pierre Weis
2003-09-20 18:42         ` [Caml-list] " skaller
2003-09-21 16:33           ` Richard Jones
2003-09-23  6:28           ` [Caml-list] A plea for clear licenses Florian Hars
2003-09-23 23:17             ` Rafael 'Dido' Sevilla
2003-09-23 23:29               ` Michael Beach
2003-09-17  9:19   ` [Caml-list] date manipulation library Stefano Zacchiroli
2003-09-17 15:28     ` Pierre Weis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.GSO.4.58.0309160026060.15139@lri \
    --to=julien.signoles@lri.fr \
    --cc=caml-list@inria.fr \
    --cc=zack@bononia.it \
    --cc=zack@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).