[#absl-DurationFromTimespec] = xref:absl.adoc[absl]::DurationFromTimespec :relfileprefix: ../ :mrdocs: Converts a `timespec` to an `absl::Duration`. == Synopsis Declared in `<absl/time/time.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:absl/Duration.adoc[Duration] DurationFromTimespec(timespec ts); ---- == Description Some APIs use a timespec or a timeval as a Duration (e.g., nanosleep(2) and select(2)), while others use them as a Time (e.g. clock_gettime(2) and gettimeofday(2)), so conversion functions are provided for both cases. The "to timespec/val" direction is easily handled via overloading, but for "from timespec/val" the desired type is part of the function name. == Return Value The equivalent duration. == Parameters [cols="1,4"] |=== | Name| Description | *ts* | The `timespec` to convert. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#