Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Function to Return time in Hr:Min:Sec:Millisec
Message
De
14/10/2003 06:02:49
 
 
À
14/10/2003 05:01:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00838380
Message ID:
00838454
Vues:
31
Hi Jos,

>Hi Fabio. Very slick solution. I like it :)

Yes, it is a slick-lack solution.

TIME() and SECONDS() are not syncronous !!! ????

On VFP :
- DATETIME(),DATE(),TIME() are syncronous.
- SECONDS() is a internal VFP value, refreshed with a timer cycle
and use a difference incremental alghoritm.
It have two problem:
For see first:
- run VFP
- run this
  STORE TIME(0) TO tt
? (VAL(m.tt)*60+VAL(SUBSTR(m.tt,4)))*60+VAL(SUBSTR(m.tt,7))+VAL(RIGHT(m.tt,2))/100-SECONDS()
- change OS time hour or minute
- return VFP
- rerun
  STORE TIME(0) TO tt
? (VAL(m.tt)*60+VAL(SUBSTR(m.tt,4)))*60+VAL(SUBSTR(m.tt,7))+VAL(RIGHT(m.tt,2))/100-SECONDS()
- SECONDS() don't see OS time changed, and now it have a shift fixed error
- close VFP and reopen, SECONDS() is resync

For see second, it is hard:
- open VFP
- run this cycle ( you see little difference )
CLEAR
tt=''
FOR I=1 TO 100
  STORE TIME(0) TO tt
? SECONDS()-((VAL(m.tt)*60+VAL(SUBSTR(m.tt,4)))*60+VAL(SUBSTR(m.tt,7))+VAL(RIGHT(m.tt,2))/100)
NEXT
- run other program, job, ....
- after 1-2 hours rerun code
CLEAR
tt=''
FOR I=1 TO 100
  STORE TIME(0) TO tt
? SECONDS()-((VAL(m.tt)*60+VAL(SUBSTR(m.tt,4)))*60+VAL(SUBSTR(m.tt,7))+VAL(RIGHT(m.tt,2))/100)
NEXT
I see 1-2 seconds error ( this is not deterministic result )

Fabio
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform