Section: sd_event_now (3)
sd_event_now - Retrieve current event loop iteration timestamp
int sd_event_now(sd_event *event, clockid_t clock, uint64_t *usec);
returns the time when the most recent event loop iteration began. A timestamp is taken right after returning from the event sleep, and before dispatching any event sources. The
parameter specifies the event loop object to retrieve the timestamp from. The
parameter specifies the clock to retrieve the timestamp for, and is one of
for more information on the various clocks. The retrieved timestamp is stored in the
parameter, in µs since the clock's epoch. If this function is invoked before the first event loop iteration, the current time is returned, as reported by
clock_gettime(). To distinguish this case from a regular invocation the return value will be positive, and zero when the returned timestamp refers to an actual event loop iteration.
If the first event loop iteration has not run yet
writes current time to
and returns a positive return value. Otherwise, it will write the requested timestamp to
and return 0. On failure, the call returns a negative errno-style error code.
Returned values may indicate the following problems:
An invalid parameter was passed.
Unsupported clock type.
The event loop object was created in a different process.
These APIs are implemented as a shared library, which can be compiled and linked to with the