Board index » delphi » MSAccess / Delphi 4 Time Bug?

MSAccess / Delphi 4 Time Bug?

I have created a MSAccess database with a Date/Time field, which I access
well through Delphi.  If I store the value "9:35 AM", then post it, the
value becomes "9:34:59 AM".  If I store "9:35:00 AM", the same thing
happens.  If I store "9:35:01 AM", it is stored correctly as "9:35:01 AM".
It also happens with several other random times.  It does not happen when I
set the value with Database Explorer.  Is this me? or is it a bug?
Thanks
 

Re:MSAccess / Delphi 4 Time Bug?


On Wed, 11 Nov 1998 12:50:51 -0500, "Douglas Keene, M.D."

Quote
<dke...@mail.com> wrote:
>I have created a MSAccess database with a Date/Time field, which I access
>well through Delphi.  If I store the value "9:35 AM", then post it, the
>value becomes "9:34:59 AM".  If I store "9:35:00 AM", the same thing
>happens.  If I store "9:35:01 AM", it is stored correctly as "9:35:01 AM".
>It also happens with several other random times.  It does not happen when I
>set the value with Database Explorer.  Is this me? or is it a bug?
>Thanks

What happens it you use Acces to store 9:35:00 AM in the field?  What
do you see in Delphi?

Delphi uses decimals to store Times in memory so it could be a
precision problem.

  9:35:00 AM corresponds to 34500/86400 = 0.399305555
  9:34:59 AM corresponds to 34499/86400 = 0.399293981

Maybe you could try displaying the time as a float (with lots of
decimals) and look at what is actually in the field.

Regards,

--
Marco Rocci
MicroEra srl
Turin, Italy

Other Threads