INTEGER FUNCTION SEC2TIME( SECS ) INTEGER, INTENT(IN ) :: SECS
C version:
int sec2timec( int secs )
H*MMSS = 10000 * hours + 100 * minutes + seconds )corresponding to the number of seconds
SECS
. Note that
according to Models-3 conventions, all three of "hours",
"minutes", and "seconds" have the same sign --
either all positive (or zero), if SECS >= 0), or all negative
(or zero) when SECS < 0.H*MMSS
-encoding suffers
INTEGER
-overflow for time periods exceeding
approximately 24.5 years.
For Fortran-90 declarations and interface checking:
USE M3UTILIO
See also TIME2SEC() and SECSDIFF()
#include "iodecl3.h"
for C.
... USE M3UTILIO !! or: INTEGER, EXTERNAL :: SEC2TIME ... INTEGER TIME ... TIME = SEC2TIME( 12345 ) !! Now TIME is the Models-3 time for 12,345 seconds !! (32545, i.e., 3 hours, 25 minutes, and 45 seconds) ... TIME = SEC2TIME( -123456 ) !! Now TIME is -341736 since (+)123,456 seconds is !! 34 hours, 17 minutes, and 36 seconds ...
... #include "iodecl3.h" ... int time ; ... time = sec2timec( -123456 ) ; /* Now time == -341736 since (+)123,456 seconds is 34 hours, 17 minutes, and 36 seconds */ ...
Up: Date-Time Manipulation Routines
To: Models-3/EDSS I/O API: The Help Pages