[#absl-DurationFromTimespec]
= xref:absl.adoc[absl]::DurationFromTimespec
:relfileprefix: ../
:mrdocs:

Converts a `timespec` to an `absl&colon;&colon;Duration`&period;

== Synopsis

Declared in `&lt;absl&sol;time&sol;time&period;h&gt;`

[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&period;g&period;, nanosleep(2) and select(2)), while others use them as a Time (e&period;g&period; clock&lowbar;gettime(2) and gettimeofday(2)), so conversion functions are provided for both cases&period; The &quot;to timespec&sol;val&quot; direction is easily handled via overloading, but for &quot;from timespec&sol;val&quot; the desired type is part of the function name&period;

== Return Value

The equivalent duration&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *ts*
| The `timespec` to convert&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
