Time count
Blitz3D Forums/Blitz3D Programming/Time count
| ||
Hi there, i have a strange behaving of this function, could anyone tell me what i'm missundestanding? Graphics 800, 600, 32 Incipit# = MilliSecs ()/10 While Not KeyDown(1) Cls If Cronos# <> Incipit# Then Cronos# = (MilliSecs ()/10 - Incipit#)/100 Text 10, 10, "Timer: " + ConvertToTime$(Cronos#) Flip Wend End Function ConvertToTime$ (Cronos#) If Cronos# >= 59.99 Then Mn = 0 + Cronos#/60 If Mn > 59 Then Hh = 0 + Mn/60 Sec# = Cronos# - ((Mn * 60) + (Hh * 3600)) StrMin$ = Mn If Len(Mn) = 1 Then StrMin$ = "0" + Mn StrSec$ = Sec# If Instr(Sec#,".") = 2 Then StrSec$ = "0" + Sec# ConvertToTime$ = Hh + ":" + StrMin$ + ":" + Left(StrSec$,5) Return ConvertToTime$ End Function when i pass the 00:01:59.xx my next shown value is 00:02:-24.x thanks for the help, cheers, jTassinari |
| ||
Function ConvertToTime$ (Cronos#) If Cronos# >= 59.99 Then Mn = 0 + Floor(Cronos#/60) If Mn > 59 Then Hh = 0 + Floor(Mn/60) Sec# = Cronos# - ((Mn * 60) + (Hh * 3600)) StrMin$ = Mn If Len(Mn) = 1 Then StrMin$ = "0" + Mn StrSec$ = Sec# If Instr(Sec#,".") = 2 Then StrSec$ = "0" + Sec# ConvertToTime$ = Hh + ":" + StrMin$ + ":" + Left(StrSec$,5) Return ConvertToTime$ End Function |
| ||
thank Xprs for you correction, i didn't know floor was included in B3D language, i just knew it in java and javascript =) thanks again for you help, cheers, jTassinari |