From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id BAA32411; Tue, 16 Sep 2003 01:29:05 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA23583 for ; Tue, 16 Sep 2003 01:29:04 +0200 (MET DST) Received: from lri.lri.fr (lri.lri.fr [129.175.15.1]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h8FNT3T00345 for ; Tue, 16 Sep 2003 01:29:03 +0200 (MET DST) Received: from localhost (localhost [127.0.0.1]) by lri.lri.fr (8.12.9/jtpda-5.4) with ESMTP id h8FNRqxS018996 ; Tue, 16 Sep 2003 01:27:52 +0200 (MEST) Date: Tue, 16 Sep 2003 01:27:52 +0200 (MEST) From: Julien Signoles X-X-Sender: signoles@lri To: Stefano Zacchiroli cc: caml-list@inria.fr, zack@debian.org, Julien Signoles Subject: Re: [Caml-list] date manipulation library In-Reply-To: <20030915183458.GA6577@fistandantilus.takhisis.org> Message-ID: References: <20030915143708.GK2354@alan-schm1p> <20030915183458.GA6577@fistandantilus.takhisis.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-Loop: caml-list@inria.fr X-Spam: no; 0.00; signoles:01 signoles:01 lri:01 caml-list:01 generic:01 generic:01 val:01 faq:01 lri:01 mcvoy:01 roman:98 bool:01 command:98 sep:01 constructors:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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