[#BloombergLP-bsls-TimeInterval-2constructor-002]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bsls.adoc[bsls]::xref:BloombergLP/bsls/TimeInterval.adoc[TimeInterval]::TimeInterval
:relfileprefix: ../../../
:mrdocs:

Create a time interval from an implicitly convertible `duration`&period;

== Synopsis

Declared in `&lt;bsls&lowbar;timeinterval&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class REP&lowbar;TYPE,
    class PERIOD&lowbar;TYPE&gt;
constexpr
TimeInterval(std::chrono::duration&lt;REP&lowbar;TYPE, PERIOD&lowbar;TYPE&gt; const& duration)
requires TimeInterval&lowbar;DurationTraits&lt;
                                   REP&lowbar;TYPE,
                                   PERIOD&lowbar;TYPE&gt;&colon;&colon;k&lowbar;IMPLICIT&lowbar;CONVERSION&lowbar;ENABLED;
----

== Description

Create a time interval having the value represented by the specified `duration`&period; Only integer representations of `duration` are supported (i&period;e&period; `REP&lowbar;TYPE` is integer)&period; If the `duration` can be represented _exactly_ by an integer nanoseconds this constructor will be implicit&period; Otherwise, the constructor will be explicit&period; The behavior is undefined unless the `duration` can be converted to a valid `TimeInterval` object, whose `seconds` field may have any 64&hyphen;bit signed integer value and `nanoseconds` field limited to the range `&lsqb; &hyphen;999,999,999&period;&period;999,999,999 &rsqb;`&period; Note that the current implementation of the lossy conversions (e&period;g&period;, fractions of a nanosecond) truncates the values towards zero, however this behavior may change without notice in the future, so _do not_ rely on this&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *duration*
| chrono duration to convert
|===


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