Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Precision in DateTime Arithmetic
Message
De
30/11/2012 06:24:31
 
 
À
29/11/2012 18:45:46
Al Doman (En ligne)
M3 Enterprises Inc.
North Vancouver, Colombie Britannique, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Divers
Thread ID:
01558431
Message ID:
01558456
Vues:
73
This message has been marked as a message which has helped to the initial question of the thread.
>Suppose you have 2 different datetime values t1 and t2.
>
>If you subtract them e.g. t2 - t1, you get the time difference in seconds. Actually it seems to be the FLOOR() of the difference i.e.
>
>- anything less than 1 second returns 0
>- anything less than 2 seconds, but greater to or equal to 1 second, returns 1
>- etc.
>
>My understanding is that as an 8-byte type, DateTime values are stored with considerable precision, of the order of about 10 milliseconds (?) Is there any way to calculate differences with more precision?
>
>I understand SECONDS() can be used to get more precision, but what I'm dealing with are DateTime values stored in tables.

vfp datetime variables store ms.
But DATETIME() return seconds only.
dt0=DTOT(DATE())
dt1=DATETIME()
dt2=m.dt1+0.643
? 0.000+(dt2-dt1)
CREATE CURSOR AA (T1 T , T2 T )
INSERT INTO AA VALUES (dt1,dt2)
? 0.000+(t2-t1)
vfp SECONDS() is not reliable respect to the real time.

then uses a system API to get datetime with ms info.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform