Author Topic: For Timings Conversions:  (Read 1248 times)

B+

  • Guest
For Timings Conversions:
« on: September 27, 2018, 03:32:25 PM »
For Timing Conversions: It is nice to have it in minutes and secs and parts of secs, here is function in QB64:
Code: [Select]
_TITLE "Click and hold down on title bar to stop time!"
start## = TIMER
DO
    CLS
    LOCATE 1, 1
    PRINT TIME$
    LOCATE 2, 4: PRINT timePassed$(start##)
    _DELAY .045
LOOP UNTIL theCowsComeHome

FUNCTION timePassed$ (started##)
    IF started## > TIMER THEN started## = started## - 86400
    tp## = TIMER - started##
    t1$ = STR$(tp##)
    dot = INSTR(t1$, ".")
    t2$ = MID$(t1$, dot, 3)
    t% = INT(tp##)
    sec% = t% MOD 60
    min% = INT(t% / 60) MOD 60
    timePassed$ = STR$(min%) + ":" + RIGHT$(STR$(sec%), 2) + t2$
END FUNCTION