SECSDIFF() and secsdiffc()

Fortran version:

    INTEGER FUNCTION  SECSDIFF( ADATE, ATIME, ZDATE, ZTIME )
        INTEGER, INTENT(IN   ) :: ADATE, ATIME	!  starting date&time
        INTEGER, INTENT(IN   ) :: ZDATE, ZTIME	!  ending   date&time

C version:

    int secsdiffc( int  adate , int  atime ,
                   int  zdate , int  ztime )

Summary:

SECSDIFF() returns the number of seconds in the time interval starting at ADATE:ATIME and ending at ZDATE:ZTIME (which will be positive if and only if ZDATE:ZTIME is after ADATE:ATIME (and negative if these are reversed). This routine is coded so as to avoid INTEGER-overflow to the extent possible. Note, however, that INTEGER seconds overflows for date-differences larger than about 68 years.

For Fortran-90 declarations and interface checking:

    USE M3UTILIO
    

See also SEC2TIME() and TIME2SEC()

Preconditions:

#include "iodecl3.h" for C.

ADATE, ATIME, ZDATE, ZTIME expressed according to Models-3 date and time conventions.

ADATE:ATIME—ZDATE:ZTIME represents a time interval of at most 68 years.

Fortran Usage:

    ...
    USE M3UTILIO
    ...
    INTEGER   SECS
    ...
    SECS = SECSDIFF( 1988001, 1, 1989365, 235959 )
    !!   Now SECS is the number of seconds from one second after
    !!   midnight on New Year's Day, 1988 until one second before
    !!   midnight on New Year's EVE, 1989.  Will be 63,071,998.
    ...
    SECS = SECSDIFF( 1988001, 0, 1988001, 1000000 )
    !!   Now SECS is 36000000, the number of seconds in 100 hours.
    !!   The time component in the arguments need not be normalized...
    ...

C Usage:

    ...
    #include "iodecl3.h"
    ...
    int  secs ;
    ...
    secs = secsdiffc( 1989365, 235959, 1988001, 1 ) ;
            /*  Now secs == -63,071,998  is negative, since this
                interval goes _backwards_ in time   */
    ...


Previous: SEC2TIME

Next: TIME2SEC

Up: Date-Time Manipulation Routines

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