Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Problem in manipulating time in mins & secs !

Author: Vincent Lejeune

Date: 03:51:07 07/21/04

Go up one level in this thread


On July 21, 2004 at 06:45:43, Gopikrishna wrote:

>On July 21, 2004 at 05:24:14, Matthias Gemuh wrote:
>
>>On July 21, 2004 at 03:45:39, Gopikrishna wrote:
>>
>>>Time is passed as double.I preffered double instead of unsigned long because for
>>>outputting fraction of secs like 2.23 secs, double is more convenient.
>>>
>>>  So ttm is passsed as double.
>>> if ((ttm/1000) >=60)
>>>{
>>>	ttm=ttm/1000;
>>>             ms=ttm/60;
>>>	ttm=(ttm-(ms1*60));
>>
>>
>>Should uninitialized ms1 be ms ?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>>	min1=(int)ms1;
>>>}
>>>else
>>>ttm=ttm/1000;
>>>
>>>In the above ms is declared as double whereas min1 as int.
>>>So when I print time as,
>>>Printf("Total time:%d min:%2.2f secs",min1,ttm);
>>>
>>>  So when time was passed as 61000 (or 61secs), its outputting as
>>>Total time:0 min:-61.00 sec
>>>Strange!!! Also another problem is its in minus.
>>>It should have been 1 min:1 sec.So am i doing anything wrong in the above?
>>>Actually I could have passed time as unsigned long instead of double but as you
>>>can see I want that secs to be accurate like 2.23 secs instead of 2 secs !
>>>  So please help me.Thanks.
>
>oops sorry it was typing mistake, yes it is ms !
>So its, ttm=(ttm-(ms*60));
>So anyone knows how to correct that?

display all values between each line to have more informations !



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.