Browse thread
.-
[
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: | -- (:) |
| From: | Julien Cristau <julien.cristau@e...> |
| Subject: | Re: [Caml-list] .- |
On 24/12/2004-11:10, Anastasia Gornostaeva wrote:
> Hello.
>
> open Unix
>
> let _ =
> let curr_time = time () in
> let curr_tm = gmtime curr_time in
> let new_time, _ = mktime {curr_tm with tm_hour = curr_tm.tm_hour+1} in
> let diff = new_time -. curr_time in
> Printf.printf "%f\n%f\n%f\n"
> curr_time
> new_time
> diff
>
>
> gives an negative result -7200.000000. Why?
>
Probably because Unix.mktime's argument is interpreted in the local time
zone (as explained in unix.mli). You probably want to call
Unix.localtime instead of Unix.gmtime.
HTH,
Julien