caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Fergus Henderson <fjh@cs.mu.OZ.AU>
To: Brian Rogoff <bpr@best.com>
Cc: Anton Moscal <msk@post.tepkom.ru>,
	John Max Skaller <skaller@ozemail.com.au>,
	caml-list@inria.fr
Subject: Re: [Caml-list] two unrelated questions
Date: Tue, 1 May 2001 04:57:06 +1000	[thread overview]
Message-ID: <20010501045706.A2562@hg.cs.mu.oz.au> (raw)
In-Reply-To: <Pine.BSF.4.21.0104291513410.473-100000@shell5.ba.best.com>

[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


  reply	other threads:[~2001-04-30 18:57 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-25 21:08 Chris Hecker
2001-04-26  0:38 ` Patrick M Doane
2001-04-26  6:04   ` Judicaël Courant
2001-04-26 12:06     ` John Max Skaller
2001-04-27  9:12       ` Anton Moscal
2001-04-29 22:24         ` Brian Rogoff
2001-04-30 18:57           ` Fergus Henderson [this message]
2001-05-01  1:31           ` Jacques Garrigue
2001-05-01 12:45             ` [Caml-list] " Ken Friis Larsen
2001-04-27 15:09       ` [Caml-list] " Brian Rogoff
2001-04-27 17:49         ` John Max Skaller
2001-04-26  8:22   ` Andreas Rossberg
2001-04-26  1:13 ` Jacques Garrigue
2001-04-26 13:47 ` Xavier Leroy
2001-04-26 22:34   ` Chris Hecker
2001-04-26 16:57 ` Mark Seaborn
2001-04-26 22:20   ` John Max Skaller
2001-05-01 21:08     ` Brian Rogoff
2001-05-01 23:30       ` John Max Skaller
2001-05-02  0:03       ` John Max Skaller
2001-05-01 17:25 Dave Berry

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=20010501045706.A2562@hg.cs.mu.oz.au \
    --to=fjh@cs.mu.oz.au \
    --cc=bpr@best.com \
    --cc=caml-list@inria.fr \
    --cc=msk@post.tepkom.ru \
    --cc=skaller@ozemail.com.au \
    /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).