[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2001-04-30 (18:57) |
From: | Fergus Henderson <fjh@c...> |
Subject: | Re: [Caml-list] two unrelated questions |
[This is getting a bit off-topic, sorry] On 29-Apr-2001, Brian Rogoff <bpr@best.com> wrote: > For instance if you want to get a date but don't want to > "pollute" the namespace with an open'ed Unix module you can write > > let get_date () = > let module M = struct > open Unix > let current_time = localtime (time()) > let current_date = > { year = current_time.tm_year > ; month = current_time.tm_mon + 1 > ; day = current_time.tm_mday > ; hour = current_time.tm_hour > ; minute = current_time.tm_min > ; second = current_time.tm_sec > } > end > in M.current_date If you're going to adjust the month, then you should adjust the year too: { year = current_time.tm_year + 1900 Otherwise the results will match neither human usage, nor Posix. -- Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit | of excellence is a lethal habit" WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp. ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr