globus_time.h(3) | Library Functions Manual | globus_time.h(3) |
globus_time.h - Time Types and Macros.
#include 'globus_types.h'
#include <time.h>
#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)
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)
Time Types and Macros.
Value:.PP
{ \ (Dest).tv_sec = (Src).tv_sec; \ (Dest).tv_nsec = (Src).tv_nsec; \ }
Copy the absolute time
Value:.PP
{ \ 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.
Value:.PP
{ \ Sec = (Abstime).tv_sec; \ USec = ((Abstime).tv_nsec / 1000); \ }
Separates abstime structure into its components, sec and usec.
Value:.PP
{ \ struct timeval __time; \ \ gettimeofday(&__time, GLOBUS_NULL); \ (Abstime).tv_sec = __time.tv_sec; \ (Abstime).tv_nsec = (__time.tv_usec * 1000); \ }
Get the current time
Value:.PP
{ \ (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
Value:.PP
{ \ 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.
Value:.PP
{ \ (Dest).tv_sec = (Src).tv_sec; \ (Dest).tv_usec = (Src).tv_usec; \ }
Copy the relative time
Value:.PP
{ \ (Reltime).tv_usec /= Factor; \ (Reltime).tv_sec /= Factor; \ }
divide the reltime by factor
Value:.PP
{ \ (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
Value:.PP
{ \ (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.
Value:.PP
{ \ Milliseconds = ((Reltime).tv_sec * 1000) + \ ((Reltime).tv_usec)/ 1000; \ }
Convert a relative time into a long in millisec units
Value:.PP
{ \ SlpInt = ((Reltime).tv_sec * 1000000) + \ ((Reltime).tv_usec); \ }
Convert a relitive time into a long in usec units
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.
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.
Returns a boolean that reflects whether or not abstime is infinity.
Has abstime expired
Returns a boolean that reflects whether or not abstime is less than the current time.
Returns a boolean that reflects whether or not reltime is infinity.
Generated automatically by Doxygen for globus_common from the source code.
Version 18.14 | globus_common |