SUBROUTINE NEXTIME( JDATE, JTIME, DTIME ) INTEGER, INTENT(INOUT) :: JDATE ! date (encoded YYYYDDD) INTEGER, INTENT(INOUT) :: JTIME ! time (encoded HHMMSS) INTEGER, INTENT(IN ) :: DTIME ! time increment (encoded HHMMSS)
void nextimec( int * jdate , int * jtime , int dtime )
DTIME may be positive, negative (to step backwards in time), or zero (just normalizes the date and time -- e.g., to turn 1988100:730000 [day 100 plus 73 hours] into 1988103:010000).)
Note that the hours field of DTIME may exceed 24 hours (for example, to step by week, DTIME should be 1680000 = 7 * 24 * 100 * 100 ). For Fortran-90 declarations and interface checking:
USE M3UTILIO
#include "iodecl3.h"
if called from C.
JDATE, JTIME, and DTIME represents dates, times, and time intervals according to Models-3 conventions:
JDATE is YYYYDDD = YEAR*1000 + DAY JTIME is HHMMSS = HOUR*10000 + MINS*100 + SECS DTIME is H*MMSS = HOUR*10000 + MINS*100 + SECSwhere for DTIME, either all of HOUR,MINS,SECS are nonnegative or all are nonpositive (i.e., don't mix positives and negatives for DTIME; "-3 hours + 5 minutes - 7 seconds" is incorrect).
... INTEGER JDATE, JTIME ... CALL NEXTIME( JDATE, JTIME, 10000 ) C ==> adds DTIME of one hour to JDATE:JTIME ... CALL NEXTIME( JDATE, JTIME, 720000 ) C ==> adds DTIME of 72 hours = 3 days to JDATE:JTIME ...
... #include "iodecl3.h" ... int jdate, jtime ... nextimec( &jdate, &jtime, 10000 ) ; /* adds dtime of 1 hour to jdate:jtime */ ...
Up: Date-Time Manipulation Routines
To: Models-3/EDSS I/O API: The Help Pages