NEXTIME() and nextimec()

Fortran version:

    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)

C version:

    void nextimec( int  * jdate , 
                   int  * jtime ,
                   int    dtime ) 

Summary:

Add time increment DTIME to the date and time JDATE:JTIME. Output is fully normalized.
In particular
CALL NEXTIME( JDATE, JTIME, 0 )
may be used to put JDATE:JTIME into normal form.

DTIME may be positive, negative (to step backwards in time), or zero (just normalizes the date and time—e.g., to turn 1988100:730000 [1988 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).
Note also that the DTIME H*MMSS-encoding suffers INTEGER-overflow for time periods exceeding approximately 24.5 years.

See also: CURRSTEP(), JSTEP3(), and LASTTIME()

For Fortran-90 declarations and interface checking:

    USE M3UTILIO
    

Preconditions:

#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  +  SECS
where 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).

Fortran Usage:

(See sample programs M3CPLE and VERTINTEGRAL for additional usage examples.)
    ...
    USE M3UTILIO
    ...
    INTEGER    JDATE, JTIME
    ...
    CALL NEXTIME( JDATE, JTIME, 10000 )
    !!  ==> adds DTIME of one hour to JDATE:JTIME
    ...
    CALL NEXTIME( JDATE, JTIME, 720000 )
    !!  ==> adds DTIME of 72 hours = 3 days to JDATE:JTIME
    ...
    CALL NEXTIME( JDATE, JTIME, -3000 )
    !!  ==> subtracts DTIME of one-half hour from JDATE:JTIME

C Usage:

    ...
    #include "iodecl3.h"
    ...
    int  jdate, jtime
    ...
    nextimec( &jdate, &jtime, 10000 ) ;
    /*  adds dtime of 1 hour to jdate:jtime  */
    ...


Previous: MMDDYY

Next: SEC2TIME

Up: Date-Time Manipulation Routines

To: Models-3/EDSS I/O API: The Help Pages