Using EncodeTime and DecodeTime to strip seconds works perfectly and seems to have
fixed all my problems. I also changed any time vars from doubles to TDateTime (but
they are the same aren't they?) for the sake of argument. Thanks for your help.
Rgds
Andrew
-----Original Message-----
From: Myles Penlington [SMTP:[EMAIL PROTECTED]]
Sent: Thursday, September 16, 1999 11:07 AM
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Time Calculations
Are you using EncodeTime?? To get your TDateTime field in minutes?
I did some testing a while back to check for this kind of problem - eg Run
for a 24 hour period and add two times and subtract to times for every
minute of the day and ensure the difference was the same - did calculation
in seconds using an integer and compared result to the TDateTime field - I
had no problems, but it did use EncodeTime
So I would be very interested to know the exact values that are causing the
problem - as this could cause me to do some major rework.
Perhaps if you do an encode and decode time and throw away the seconds
values it will all work okay?
Would like to know your results.
Thanks
Myles.
> -----Original Message-----
> From: Andrew Masters [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, September 16, 1999 10:50 AM
> To: Multiple recipients of list delphi
> Subject: [DUG]: Time Calculations
>
> Hi,
>
> I'm having trouble doing calculations with times. All I want to do is to
> be able to add x minutes to a time and compare with another time. Trouble
> is I'm getting some time values from an IB DateTime column, comparing with
> times in a double var that I've added x minutes to etc, some formatted
> with 'hh:nn am/pm' etc etc
>
> Is there a tried and tested method of standardising time values and
> performing simple arithetic on them ?
>
> What I'm doing is working 95% of the time. The problem I have seems to be
> related to seconds which I am not interested in and/or rounding of some
> values.
>
> TIA
> Andrew
> Clinical Solutions Ltd
> Unit L, 11 Piermark Dr
> Albany
> Auckland, NZ
> Ph: +64-9-476-0106
> Fax: +64-9-476-0108
> e: [EMAIL PROTECTED]
>
> --------------------------------------------------------------------------
> -
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
application/ms-tnef