Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A Datetime problem
Message
De
24/12/1999 12:32:34
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
23/12/1999 09:48:51
Paul Frost
Instem Computer Systems Ltd
Stone, Royaume Uni
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00305771
Message ID:
00308425
Vues:
41
>>Unlike dates, datetime is stored as a double. I hit this sometime ago too and discussed here. If hour portion is not a multiple of 3 then roundation problems occur.
>
>From my understanding, it's not strictly a double, it's actually 2 integers. DateTime is stored in 8 bytes, the first 4 bytes are in integer date, offset from 1/1/100, the remaining 4 bytes are the time in milliseconds since midnight (If I'm wrong, I know I'll be shot down in flames, regardless of how close to Christmas & the season of goodwill, I'm quoting from VfP 5 help here, which has exactly the same problem).
>
>If this is the case, then any difference cannot really be explained as rounding error. And even if rounding error, why a difference of multiples of exactly 3 hours (180000 mS) should have no rounding error.
>
>Paul


Yes Paul you're right that it's not strictly a double, 2 integers. How datetime math is the problem IMHO. There should be a conversion to double.
Try this :

ltTime1 = {1/1/1999 00:00:00}
ltTime2 = {1/1/1999 01:00:00}
ltTime3 = {1/1/1999 02:00:00}
ltTime4 = {1/1/1999 03:00:00}
ltTime5 = {1/1/1999 04:00:00}
ltTime6 = {1/1/1999 05:00:00}
ltTime7 = {1/1/1999 06:00:00}
ltTime8 = {1/1/1999 07:00:00}

? (ltTime2 - ltTime1) * 1.0000000000
? (ltTime3 - ltTime1) * 1.0000000000
? (ltTime4 - ltTime1) * 1.0000000000
? (ltTime5 - ltTime1) * 1.0000000000
? (ltTime6 - ltTime1) * 1.0000000000
? (ltTime7 - ltTime1) * 1.0000000000
? (ltTime8 - ltTime1) * 1.0000000000

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform