You can retrieve the clock easily enough via file_time_type::clock
. But converting from one clock to another won't really be possible until the changes from C++20 are available.
The reason the clock even matters is that different clocks define a different "epoch" start date, the 0 time point for that clock. But in C++11-17, all clocks have an implementation-defined "epoch", and each clock can use a different one. The file_time_type::clock
is no different. Since every implementation of every clock potentially uses a different epoch, and no clock epochs are defined relative to each other, there's no way to convert one clock's time_point
into another clock's time_point
. Not without implementation-specific knowledge.
C++20 changes things in exactly one way: system_clock
has a well-defined epoch: it uses UNIX-time. Because there is one clock with a well-defined epoch, that clock can act as a universal intermediate clock for clock-to-clock conversions. That is, every implementation-defined clock's epoch can be converted relative to UNIX-time, and vice-versa. Hence: clock_cast
.
Without that definition, and the time_conversion
machinery, there's not much you can do... portably, at least.