Apache Portable Runtime
Data Structures | Macros | Typedefs | Functions | Variables

Data Structures

struct  apr_time_exp_t
 

Macros

#define APR_TIME_C(val)   APR_INT64_C(val)
 
#define APR_TIME_T_FMT   APR_INT64_T_FMT
 
#define APR_USEC_PER_SEC   APR_TIME_C(1000000)
 
#define apr_time_sec(time)   ((time) / APR_USEC_PER_SEC)
 
#define apr_time_usec(time)   ((time) % APR_USEC_PER_SEC)
 
#define apr_time_msec(time)   (((time) / 1000) % 1000)
 
#define apr_time_as_msec(time)   ((time) / 1000)
 
#define apr_time_from_msec(msec)   ((apr_time_t)(msec) * 1000)
 
#define apr_time_from_sec(sec)   ((apr_time_t)(sec) * APR_USEC_PER_SEC)
 
#define apr_time_make(sec, usec)
 
#define APR_RFC822_DATE_LEN   (30)
 
#define APR_CTIME_LEN   (25)
 

Typedefs

typedef apr_int64_t apr_time_t
 
typedef apr_int64_t apr_interval_time_t
 
typedef apr_int32_t apr_short_interval_time_t
 
typedef struct apr_time_exp_t apr_time_exp_t
 

Functions

apr_time_t apr_time_now (void)
 
apr_status_t apr_time_ansi_put (apr_time_t *result, time_t input)
 
apr_status_t apr_time_exp_tz (apr_time_exp_t *result, apr_time_t input, apr_int32_t offs)
 
apr_status_t apr_time_exp_gmt (apr_time_exp_t *result, apr_time_t input)
 
apr_status_t apr_time_exp_lt (apr_time_exp_t *result, apr_time_t input)
 
apr_status_t apr_time_exp_get (apr_time_t *result, apr_time_exp_t *input)
 
apr_status_t apr_time_exp_gmt_get (apr_time_t *result, apr_time_exp_t *input)
 
void apr_sleep (apr_interval_time_t t)
 
apr_status_t apr_rfc822_date (char *date_str, apr_time_t t)
 
apr_status_t apr_ctime (char *date_str, apr_time_t t)
 
apr_status_t apr_strftime (char *s, apr_size_t *retsize, apr_size_t max, const char *format, apr_time_exp_t *tm)
 
void apr_time_clock_hires (apr_pool_t *p)
 

Variables

const char apr_month_snames [12][4]
 
const char apr_day_snames [7][4]
 

Detailed Description

Macro Definition Documentation

#define APR_CTIME_LEN   (25)

length of a CTIME date

#define APR_RFC822_DATE_LEN   (30)

length of a RFC822 Date

#define apr_time_as_msec (   time)    ((time) / 1000)
Returns
apr_time_t as a msec
#define APR_TIME_C (   val)    APR_INT64_C(val)

mechanism to properly type apr_time_t literals

#define apr_time_from_msec (   msec)    ((apr_time_t)(msec) * 1000)
Returns
milliseconds as an apr_time_t
#define apr_time_from_sec (   sec)    ((apr_time_t)(sec) * APR_USEC_PER_SEC)
Returns
seconds as an apr_time_t
#define apr_time_make (   sec,
  usec 
)
Value:
+ (apr_time_t)(usec))
#define APR_USEC_PER_SEC
Definition: apr_time.h:60
apr_int64_t apr_time_t
Definition: apr_time.h:45
Returns
a second and usec combination as an apr_time_t
#define apr_time_msec (   time)    (((time) / 1000) % 1000)
Returns
apr_time_t as a msec
#define apr_time_sec (   time)    ((time) / APR_USEC_PER_SEC)
Returns
apr_time_t as a second
#define APR_TIME_T_FMT   APR_INT64_T_FMT

mechanism to properly print apr_time_t values

#define apr_time_usec (   time)    ((time) % APR_USEC_PER_SEC)
Returns
apr_time_t as a usec
#define APR_USEC_PER_SEC   APR_TIME_C(1000000)

number of microseconds per second

Typedef Documentation

typedef apr_int64_t apr_interval_time_t

intervals for I/O timeouts, in microseconds

typedef apr_int32_t apr_short_interval_time_t

short interval for I/O timeouts, in microseconds

See also
apr_time_exp_t
typedef apr_int64_t apr_time_t

number of microseconds since 00:00:00 January 1, 1970 UTC

Function Documentation

apr_status_t apr_ctime ( char *  date_str,
apr_time_t  t 
)

apr_ctime formats dates in the ctime() format in an efficient manner. It is a fixed length format and requires APR_CTIME_LEN bytes of storage including the trailing NUL terminator. Unlike ANSI/ISO C ctime(), apr_ctime() does not include a \n at the end of the string.

Parameters
date_strString to write to.
tthe time to convert
apr_status_t apr_rfc822_date ( char *  date_str,
apr_time_t  t 
)

apr_rfc822_date formats dates in the RFC822 format in an efficient manner. It is a fixed length format which requires APR_RFC822_DATA_LEN bytes of storage, including the trailing NUL terminator.

Parameters
date_strString to write to.
tthe time to convert
void apr_sleep ( apr_interval_time_t  t)

Sleep for the specified number of micro-seconds.

Parameters
tdesired amount of time to sleep.
Warning
May sleep for longer than the specified time.
apr_status_t apr_strftime ( char *  s,
apr_size_t *  retsize,
apr_size_t  max,
const char *  format,
apr_time_exp_t tm 
)

Formats the exploded time according to the format specified

Parameters
sstring to write to
retsizeThe length of the returned string
maxThe maximum length of the string
formatThe format for the time string
tmThe time to convert
apr_status_t apr_time_ansi_put ( apr_time_t result,
time_t  input 
)

Convert an ansi time_t to an apr_time_t

Parameters
resultthe resulting apr_time_t
inputthe time_t to convert
void apr_time_clock_hires ( apr_pool_t p)

Improve the clock resolution for the lifetime of the given pool. Generally this is only desirable on benchmarking and other very time-sensitive applications, and has no impact on most platforms.

Parameters
pThe pool to associate the finer clock resolution
apr_status_t apr_time_exp_get ( apr_time_t result,
apr_time_exp_t input 
)

Convert time value from human readable format to a numeric apr_time_t (elapsed microseconds since the epoch).

Parameters
resultthe resulting imploded time
inputthe input exploded time
apr_status_t apr_time_exp_gmt ( apr_time_exp_t result,
apr_time_t  input 
)

Convert a time to its human readable components (GMT).

Parameters
resultthe exploded time
inputthe time to explode
apr_status_t apr_time_exp_gmt_get ( apr_time_t result,
apr_time_exp_t input 
)

Convert time value from human readable format to a numeric apr_time_t that always represents GMT.

Parameters
resultthe resulting imploded time
inputthe input exploded time
apr_status_t apr_time_exp_lt ( apr_time_exp_t result,
apr_time_t  input 
)

Convert a time to its human readable components in the local timezone.

Parameters
resultthe exploded time
inputthe time to explode
apr_status_t apr_time_exp_tz ( apr_time_exp_t result,
apr_time_t  input,
apr_int32_t  offs 
)

Convert a time to its human readable components using an offset from GMT.

Parameters
resultthe exploded time
inputthe time to explode
offsthe number of seconds offset to apply
apr_time_t apr_time_now ( void  )
Returns
the current time

Variable Documentation

const char apr_day_snames[7][4]

day names

const char apr_month_snames[12][4]

month names