From: skaller <skaller@users.sourceforge.net>
To: Denis Bueno <dbueno@gmail.com>
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Time stamp module floating around?
Date: Sun, 21 Jan 2007 19:43:49 +1100 [thread overview]
Message-ID: <1169369029.6178.2.camel@rosella.wigram> (raw)
In-Reply-To: <6dbd4d000701201842h5130b540x97648a3d2d058e6e@mail.gmail.com>
On Sat, 2007-01-20 at 21:42 -0500, Denis Bueno wrote:
> I'm looking for simple bit of code that will print human-readable
> timestamps. Something suitable for a log file.
(*
Scrap used in Felix for lines like:
//Timestamp: 2007/1/12 18:36:37 UTC
//Timestamp: 2007/1/13 5:36:37 (local)
*)
let tim() =
let now = (Unix.times()).Unix.tms_utime in
let elapsed = now -. !last_time in
last_time := now;
elapsed
;;
let format_time tm =
si (tm.Unix.tm_year + 1900) ^ "/" ^
si (tm.Unix.tm_mon + 1) ^ "/" ^
si tm.Unix.tm_mday ^ " " ^
si tm.Unix.tm_hour ^ ":" ^
si tm.Unix.tm_min ^ ":" ^
si tm.Unix.tm_sec
;;
try
(* Time initialisation *)
let compile_start = Unix.time () in
let compile_start_gm = Unix.gmtime compile_start in
let compile_start_local = Unix.localtime compile_start in
let compile_start_gm_string = format_time compile_start_gm ^ " UTC" in
let compile_start_local_string = format_time compile_start_local ^
" (local)" in
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
next prev parent reply other threads:[~2007-01-21 8:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-21 2:42 Denis Bueno
2007-01-21 3:48 ` [Caml-list] " Chris King
2007-01-21 8:43 ` skaller [this message]
2007-01-21 9:24 ` Nicolas George
2007-01-21 9:53 ` Robert Roessler
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=1169369029.6178.2.camel@rosella.wigram \
--to=skaller@users.sourceforge.net \
--cc=caml-list@inria.fr \
--cc=dbueno@gmail.com \
/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