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 UAA21635; Mon, 30 Apr 2001 20:57:20 +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 UAA21562 for ; Mon, 30 Apr 2001 20:57:19 +0200 (MET DST) Received: from mumnunah.cs.mu.OZ.AU (mail-gate.cs.mu.oz.au [198.142.254.221]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f3UIvCX05659 for ; Mon, 30 Apr 2001 20:57:14 +0200 (MET DST) Received: from hg.cs.mu.oz.au (root@hg.cs.mu.OZ.AU [128.250.25.19]) by mumnunah.cs.mu.OZ.AU with ESMTP id EAA19833; Tue, 1 May 2001 04:57:08 +1000 (EST) Received: (from fjh@localhost) by hg.cs.mu.oz.au (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id EAA04414; Tue, 1 May 2001 04:57:06 +1000 Date: Tue, 1 May 2001 04:57:06 +1000 From: Fergus Henderson To: Brian Rogoff Cc: Anton Moscal , John Max Skaller , caml-list@inria.fr Subject: Re: [Caml-list] two unrelated questions Message-ID: <20010501045706.A2562@hg.cs.mu.oz.au> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre3i In-Reply-To: Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk [This is getting a bit off-topic, sorry] On 29-Apr-2001, Brian Rogoff 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 | "I have always known that the pursuit | of excellence is a lethal habit" WWW: | -- the last words of T. S. Garp. ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr