Scroll to navigation

globus_time.h(3) globus_common globus_time.h(3)

NAME

globus_time.h - Time Types and Macros.

SYNOPSIS

#include 'globus_types.h'
#include <time.h>

Macros


#define GlobusTimeAbstimeSet(Abstime, Sec, USec)
#define GlobusTimeAbstimeGet(Abstime, Sec, USec)
#define GlobusTimeReltimeSet(Reltime, Sec, USec)
#define GlobusTimeAbstimeDiff(Reltime, T1, T2)
#define GlobusTimeReltimeToUSec(SlpInt, Reltime)
#define GlobusTimeReltimeToMilliSec(Milliseconds, Reltime)
#define GlobusTimeAbstimeInc(Abstime, Reltime)
#define GlobusTimeAbstimeGetCurrent(Abstime)
#define GlobusTimeAbstimeCopy(Dest, Src)
#define GlobusTimeReltimeCopy(Dest, Src)
#define GlobusTimeReltimeMultiply(Reltime, Factor)
#define GlobusTimeReltimeDivide(Reltime, Factor)

Functions


globus_bool_t globus_time_has_expired (const globus_abstime_t *abstime)
globus_bool_t globus_time_abstime_is_infinity (const globus_abstime_t *abstime)
globus_bool_t globus_time_reltime_is_infinity (const globus_reltime_t *reltime)
int globus_abstime_cmp (const globus_abstime_t *abstime_1, const globus_abstime_t *abstime_2)
int globus_reltime_cmp (const globus_reltime_t *reltime_1, const globus_reltime_t *reltime_2)

Detailed Description

Time Types and Macros.

Macro Definition Documentation

#define GlobusTimeAbstimeCopy(Dest, Src)

Value:

{                                                            (Dest).tv_sec = (Src).tv_sec;                             (Dest).tv_nsec = (Src).tv_nsec;                        }
Copy the absolute time

#define GlobusTimeAbstimeDiff(Reltime, T1, T2)

Value:

{                                                             int __res = globus_abstime_cmp(&(T1), &(T2));             if(__res < 0)                                             {                                                             (Reltime).tv_sec = (T2).tv_sec - (T1).tv_sec;             (Reltime).tv_usec =                                               (((T2).tv_nsec - (T1).tv_nsec) / 1000);           if((Reltime).tv_usec < 0)                                 {                                                             (Reltime).tv_sec--;                                       (Reltime).tv_usec += 1000000;                         }                                                     }                                                         else if(__res > 0)                                        {                                                             (Reltime).tv_sec = (T1).tv_sec - (T2).tv_sec;             (Reltime).tv_usec =                                               (((T1).tv_nsec - (T2).tv_nsec) / 1000);           if((Reltime).tv_usec < 0)                                 {                                                             (Reltime).tv_sec--;                                       (Reltime).tv_usec += 1000000;                         }                                                     }                                                         else                                                      {                                                             (Reltime).tv_sec = 0;                                     (Reltime).tv_usec = 0;                                }                                                     }
Find the difference between the 2 absolute times.

#define GlobusTimeAbstimeGet(Abstime, Sec, USec)

Value:

{                                                             Sec = (Abstime).tv_sec;                                   USec = ((Abstime).tv_nsec / 1000);                    }
Separates abstime structure into its components, sec and usec.

#define GlobusTimeAbstimeGetCurrent(Abstime)

Value:


{ struct timeval __time; gettimeofday(&__time, GLOBUS_NULL); (Abstime).tv_sec = __time.tv_sec; (Abstime).tv_nsec = (__time.tv_usec * 1000); }
Get the current time

#define GlobusTimeAbstimeInc(Abstime, Reltime)

Value:

{                                                             (Abstime).tv_nsec += ((Reltime).tv_usec * 1000);          if((Abstime).tv_nsec >= 1000000000)                        {                                                             (Abstime).tv_sec++;                                       (Abstime).tv_nsec -= 1000000000;                      }                                                         (Abstime).tv_sec += (Reltime).tv_sec;                 }
Add reltime to abstime

#define GlobusTimeAbstimeSet(Abstime, Sec, USec)

Value:

{                                                             GlobusTimeAbstimeGetCurrent(Abstime);                     (Abstime).tv_nsec += (USec * 1000);                       if((Abstime).tv_nsec >= 1000000000)                        {                                                             (Abstime).tv_sec += ((Abstime).tv_nsec / 1000000000);        (Abstime).tv_nsec = (Abstime).tv_nsec  % 1000000000;     }                                                         (Abstime).tv_sec += Sec;                              }
Set the abstime structure to the sec and usec parameter values.

#define GlobusTimeReltimeCopy(Dest, Src)

Value:

{                                                            (Dest).tv_sec = (Src).tv_sec;                             (Dest).tv_usec = (Src).tv_usec;                        }
Copy the relative time

#define GlobusTimeReltimeDivide(Reltime, Factor)

Value:

{                                                            (Reltime).tv_usec /= Factor;                              (Reltime).tv_sec /= Factor;                            }
divide the reltime by factor

#define GlobusTimeReltimeMultiply(Reltime, Factor)

Value:

{                                                            (Reltime).tv_usec *= Factor;                              (Reltime).tv_sec *= Factor;                                                                                          if((Reltime).tv_usec >= 1000000)                          {                                                             (Reltime).tv_sec += ((Reltime).tv_usec / 1000000);        (Reltime).tv_usec = (Reltime).tv_usec  % 1000000;     }                                                     }
Multiple the reltime by factor

#define GlobusTimeReltimeSet(Reltime, Sec, USec)

Value:

{                                                             (Reltime).tv_usec = (USec);                               (Reltime).tv_sec = Sec;                                   if((Reltime).tv_usec >= 1000000)                          {                                                             (Reltime).tv_sec += ((Reltime).tv_usec / 1000000);        (Reltime).tv_usec = (Reltime).tv_usec  % 1000000;     }                                                     }
Set the reltime structure to the sec and usec parameter values.

#define GlobusTimeReltimeToMilliSec(Milliseconds, Reltime)

Value:

{                                                             Milliseconds = ((Reltime).tv_sec * 1000) +                                          ((Reltime).tv_usec)/ 1000;   }
Convert a relative time into a long in millisec units

#define GlobusTimeReltimeToUSec(SlpInt, Reltime)

Value:

{                                                             SlpInt = ((Reltime).tv_sec * 1000000) +                                                    ((Reltime).tv_usec); }
Convert a relitive time into a long in usec units

Function Documentation

int globus_abstime_cmp (const globus_abstime_t * abstime_1, const globus_abstime_t * abstime_2)

Compare two absolute times.

This function returns an integer that reflects the comparison of two abstimes in the following way.

0 : values are the same. -1 : the first value is less than the second. 1 : the first value is greater than the second.

int globus_reltime_cmp (const globus_reltime_t * reltime_1, const globus_reltime_t * reltime_2)

Compare two absolute times.

This function returns an integer that reflects the comparison of two reltimes in the following way.

0 : values are the same. -1 : the first value is less than the second. 1 : the first value is greater than the second.

globus_bool_t globus_time_abstime_is_infinity (const globus_abstime_t * abstime)

Returns a boolean that reflects whether or not abstime is infinity.

globus_bool_t globus_time_has_expired (const globus_abstime_t * abstime)

Has abstime expired

Returns a boolean that reflects whether or not abstime is less than the current time.

globus_bool_t globus_time_reltime_is_infinity (const globus_reltime_t * reltime)

Returns a boolean that reflects whether or not reltime is infinity.

Author

Generated automatically by Doxygen for globus_common from the source code.

Tue Jul 5 2022 Version 18.13