FUNCTIONS CORE

SecToTime()

Convert numeric seconds into a time formatted character string

Syntax

Signature
SecToTime( [nSeconds], [lHundredth] ) --> cTime

Arguments

nSeconds

lHundredth

Example

SecToTime.prg
PROCEDURE Main()

   LOCAL nBegin := 170
   LOCAL nEnd   := 3656

   Check( 'SecToTime( nEnd - nBegin )   ', SecToTime( nEnd - nBegin ), "00:58:06" )
   Check( 'SecToTime( 45873.22, .T. )   ', SecToTime( 45873.22, .T. ), "12:44:33:22" )
   Check( 'SecToTime( 45366.98 )        ', SecToTime( 45366.98 ), "12:36:06" )
   Check( 'SecToTime( 90000 )           ', SecToTime( 90000 ), "01:00:00" )

RETURN

STATIC PROCEDURE Check( cTitle, xResult, xExpected )

   QOut( cTitle + IIF( xResult == xExpected, "OK", "ERROR" ) )

RETURN

Output

SecToTime( nEnd - nBegin )   OK
SecToTime( 45873.22, .T. )   OK
SecToTime( 45366.98 )        OK
SecToTime( 90000 )           OK