mirror of
https://gitlab.com/scemama/qmcchem.git
synced 2025-02-09 11:14:12 +01:00
27 lines
476 B
OCaml
27 lines
476 B
OCaml
|
let of_sec s =
|
||
|
Unix.gmtime s
|
||
|
|
||
|
let to_sec t =
|
||
|
let sec = t.Unix.tm_sec
|
||
|
and min = t.Unix.tm_min
|
||
|
and hour = t.Unix.tm_hour
|
||
|
and mday = t.Unix.tm_mday
|
||
|
in
|
||
|
sec +
|
||
|
min * 60 +
|
||
|
hour * 60 * 60 +
|
||
|
mday * 60 * 60 * 24
|
||
|
|
||
|
let string_of_t t =
|
||
|
let mday = t.Unix.tm_mday in
|
||
|
let sec = t.Unix.tm_sec
|
||
|
and min = t.Unix.tm_min
|
||
|
and hour = t.Unix.tm_hour + 24*mday
|
||
|
in
|
||
|
Printf.sprintf "%2d:%2d:%2d" hour min sec
|
||
|
|
||
|
let string_of_sec s =
|
||
|
of_sec s
|
||
|
|> string_of_t
|
||
|
|