Quick Links: |
Provide functionality of the corresponding C++ Standard header. More...
<bsl_chrono.h>
directly. This component imports symbols declared in the <chrono> header file implemented in the standard library provided by the compiler vendor. bsl::chrono::duration
objects with various duration periods such as hours, minutes, seconds, milliseconds, microseconds and nanoseconds. The ud-suffixes are preceded with the _
symbol to distinguish between the bsl
-chrono's UDLs and the std
-chrono's UDLs introduced in the C++14 standard and implemented in the standard library. Note that bsl
-chrono's UDLs, unlike the std
-chrono's UDLs, can be used in a client's code if the current compiler supports the C++11 standard. bsl
-chrono's UDL operators are declared in the bsl::literals::chrono_literals
namespace, where literals
and chrono_literals
are inline namespaces. Access to these operators can be gained with either using namespace bsl::literals
, using namespace bsl::chrono_literals
or using namespace bsl::literals::chrono_literals
. But we recommend using namespace bsl::chrono_literals
to minimize the scope of the using declaration. bsl
-chrono's UDLs. using namespace bsl::chrono_literals;
operator "" _h
. auto hours_in_a_day = 24_h; auto halfhour = 0.5_h;
stdout
: printf("one day is %ld hours\n", hours_in_a_day.count()); printf("half an hour is %.1f hours\n", static_cast<double>(halfhour.count()));
stdout
: one day is 24 hours half an hour is 0.5 hours