'\" t .TH "SD_EVENT_NOW" "3" "" "elogind 246.9.1" "sd_event_now" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" sd_event_now \- Retrieve current event loop iteration timestamp .SH "SYNOPSIS" .sp .ft B .nf #include .fi .ft .HP \w'int\ sd_event_now('u .BI "int sd_event_now(sd_event\ *" "event" ", clockid_t\ " "clock" ", uint64_t\ *" "usec" ");" .SH "DESCRIPTION" .PP \fBsd_event_now()\fR 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 \fIevent\fR parameter specifies the event loop object to retrieve the timestamp from\&. The \fIclock\fR parameter specifies the clock to retrieve the timestamp for, and is one of \fBCLOCK_REALTIME\fR (or equivalently \fBCLOCK_REALTIME_ALARM\fR), \fBCLOCK_MONOTONIC\fR, or \fBCLOCK_BOOTTIME\fR (or equivalently \fBCLOCK_BOOTTIME_ALARM\fR), see \fBclock_gettime\fR(2) for more information on the various clocks\&. The retrieved timestamp is stored in the \fIusec\fR parameter, in \(mcs since the clock\*(Aqs epoch\&. If this function is invoked before the first event loop iteration, the current time is returned, as reported by \fBclock_gettime()\fR\&. 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\&. .SH "RETURN VALUE" .PP If the first event loop iteration has not run yet \fBsd_event_now()\fR writes current time to \fIusec\fR and returns a positive return value\&. Otherwise, it will write the requested timestamp to \fIusec\fR and return 0\&. On failure, the call returns a negative errno\-style error code\&. .SS "Errors" .PP Returned values may indicate the following problems: .PP \fB\-EINVAL\fR .RS 4 An invalid parameter was passed\&. .RE .PP \fB\-EOPNOTSUPP\fR .RS 4 Unsupported clock type\&. .RE .PP \fB\-ECHILD\fR .RS 4 The event loop object was created in a different process\&. .RE .SH "NOTES" .PP These APIs are implemented as a shared library, which can be compiled and linked to with the \fBlibelogind\fR\ \&\fBpkg-config\fR(1) file\&. .SH "SEE ALSO" .PP \fBelogind\fR(8), \fBsd-event\fR(3), \fBsd_event_new\fR(3), \fBsd_event_add_time\fR(3), \fBclock_gettime\fR(2)