winrt::clock struct (C++/WinRT)
A type containing static helper functions for converting a Windows::Foundation::DateTime (that is, a std::chrono::time_point) to and from winrt::file_time, and to and from time_t.
winrt::clock is defined as using the same units as Windows::Foundation::DateTime (a signed 64-bit integer of 100-nanosecond intervals since Jan 1 1601). Other C++ standard clocks don't typically define their resolution, and don't use the epoch Jan 1 1601, which is a Windows Runtime/FILETIME epoch.
struct clock
Minimum supported SDK: Windows SDK version 10.0.17134.0 (Windows 10, version 1803)
Namespace: winrt
Header: %WindowsSdkDir%Include<WindowsTargetPlatformVersion>\cppwinrt\winrt\base.h (included by default)
Alias name | Type |
---|---|
clock::rep | A synonym for int64_t. |
clock::period | A synonym for Windows::Foundation::TimeSpan::period. |
clock::duration | A synonym for Windows::Foundation::TimeSpan. |
clock::time_point | A synonym for Windows::Foundation::DateTime. |
Function | Description |
---|---|
clock::now function | Retrieves the current time as a Windows::Foundation::DateTime. |
clock::from_file_time function | Converts a winrt::file_time value to a Windows::Foundation::DateTime. |
clock::from_time_t function | Converts a time_t value to a Windows::Foundation::DateTime. |
clock::to_file_time function | Converts a Windows::Foundation::DateTime value to a winrt::file_time. |
clock::to_time_t function | Converts a Windows::Foundation::DateTime value to a time_t. |
Retrieves the current time as a Windows::Foundation::DateTime.
static Windows::Foundation::DateTime now() noexcept;
The current time as a Windows::Foundation::DateTime.
Converts a winrt::file_time value to a Windows::Foundation::DateTime.
static Windows::Foundation::DateTime from_file_time(winrt::file_time const& time) noexcept;
time
A winrt::file_time value to convert to a Windows::Foundation::DateTime.
The winrt::file_time value converted into a Windows::Foundation::DateTime.
Converts a time_t value to a Windows::Foundation::DateTime.
static Windows::Foundation::DateTime from_time_t(time_t time) noexcept;
time
A time_t value to convert to a Windows::Foundation::DateTime.
The time_t value converted into a Windows::Foundation::DateTime.
Converts a Windows::Foundation::DateTime value to a winrt::file_time.
static file_time to_file_time(Windows::Foundation::DateTime const& time) noexcept;
time
A Windows::Foundation::DateTime value to convert to a winrt::file_time.
The Windows::Foundation::DateTime value converted into a winrt::file_time.
Converts a Windows::Foundation::DateTime value to a time_t.
static time_t to_time_t(Windows::Foundation::DateTime const& time) noexcept;
time
A Windows::Foundation::DateTime value to convert to a time_t*.
The Windows::Foundation::DateTime value converted into a time_t.