From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id CFA18BB91 for ; Fri, 24 Dec 2004 12:07:26 +0100 (CET) Received: from deliver.uni-koblenz.de (deliver.uni-koblenz.de [141.26.64.15]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iBOB7Qan002852 for ; Fri, 24 Dec 2004 12:07:26 +0100 Received: from localhost (localhost [127.0.0.1]) by deliver.uni-koblenz.de (Postfix) with ESMTP id 6C362E298; Fri, 24 Dec 2004 12:02:34 +0100 (CET) Received: from deliver.uni-koblenz.de ([127.0.0.1]) by localhost (deliver [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 11018-03; Fri, 24 Dec 2004 12:02:34 +0100 (CET) Received: from [217.85.206.32] (pD955CE20.dip.t-dialin.net [217.85.206.32]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTP id CF8C7E272; Fri, 24 Dec 2004 12:02:33 +0100 (CET) Message-ID: <41CBF877.3070102@epost.de> Date: Fri, 24 Dec 2004 12:07:35 +0100 From: Alexander Fuchs User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041115 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Anastasia Gornostaeva Cc: Caml-list@yquem.inria.fr Subject: Re: [Caml-list] .- References: <20041224100422.GA10012@ermine.home> In-Reply-To: <20041224100422.GA10012@ermine.home> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at uni-koblenz.de X-Miltered: at nez-perce with ID 41CBF86E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 wrote:01 printf:01 printf:01 unix:01 curr:01 curr:01 argument:01 diff:01 diff:01 alexander:02 alexander:02 alex:03 let:03 let:03 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.4 required=5.0 tests=DNS_FROM_RFC_ABUSE autolearn=disabled version=3.0.0 X-Spam-Level: Anastasia Gornostaeva wrote: > 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? Form the manual: gmtime : Assumes UTC (Coordinated Universal Time), also known as GMT. mktime : The tm argument is interpreted in the local time zone. So, actually you compare GMT with your local time zone, which in my case (Germany) returns 0 for the above example. Try localtime instead of gmtime: localtime : Assumes the local time zone. Alex