libiso8601  0.3.14
Functions
C library integration.

Functions

void iso8601_now (struct iso8601_date *date, struct iso8601_details *details)
 Retrieve the current time. More...
 
int iso8601_set_sysclock (const struct iso8601_date *date)
 Set the system clock. More...
 
void iso8601_from_ts (struct iso8601_date *date, const struct timespec *ts)
 Convert from a struct timespec.
 
void iso8601_to_ts (struct timespec *ts, const struct iso8601_date *date)
 Convert to a struct timespec.
 
void iso8601_from_tv (struct iso8601_date *date, const struct timeval *tv)
 Convert from a struct timeval.
 
void iso8601_to_tv (struct timeval *tv, const struct iso8601_date *date)
 Convert to a struct timeval.
 
void iso8601_from_time_t (struct iso8601_date *date, const time_t *t)
 Convert from a time_t.
 
void iso8601_to_time_t (time_t *t, const struct iso8601_date *date)
 Convert to a time_t.
 

Detailed Description

These functions enable integration with the C library (system call wrappers and conversion).

Function Documentation

◆ iso8601_now()

void iso8601_now ( struct iso8601_date date,
struct iso8601_details details 
)

Retrieve the current time.

Parameters
[out]dateCurrent date/time (may be 0), in UTC. May be 0.
[out]detailsDetails (may be 0), including timezone. May be 0.

Retrieves the current time from the system clock, storing it into date and details (both parameters optional).

◆ iso8601_set_sysclock()

int iso8601_set_sysclock ( const struct iso8601_date date)

Set the system clock.

Parameters
dateDate to set.
Return values
0on success.
-1on error (and see errno).

Attempts to set the system clock using clock_settime(), falling back to settimeofday(). The user will need the CAP_SYS_TIME capability to set the clock, otherwise errno will be set to EPERM.