Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compare how much time passes between
Message
From
14/05/2002 09:38:28
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00655079
Message ID:
00656107
Views:
25
Hi Sergey, I'm doing this also, and don't get exact results or else I'm misunderstanding something here. Is something wrong with the rounding? From your example, try this:
clear
Store DATETIME() TO datetime1
? datetime1
WAIT WINDOW "Waiting 5 seconds" TIMEOUT 5
Store DATETIME() TO datetime2
? datetime2
lnSeconds = ROUND( datetime1 - datetime2, 0)
? lnSeconds
lndiff=SecToTime(lnSeconds)
?lndiff
? "shouldn't it return 0:00:05, not 0:59:55?"

FUNCTION SecToTime
* Convert seconds to the Time string
PARAM nSeconds
LOCAL cHH, nTm, cMM, cSec, cTime, i
cHH = ALLT(STR(INT(nSeconds / 3600)))
nTm = nSeconds % 3600
cMM = PADL(INT(nTm / 60), 2, "0")
cSec = PADL(MOD(nTm, 60), 2, "0")
cTime = cHH + ":" + cMM + ":" + cSec
RETURN cTime
TIA,
Tracy
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform