Date: Thu, 30 Jan 2025 07:14:33 -0800
Hi Jens!
> On Jan 30, 2025, at 2:24 AM, Jens Maurer <jens.maurer_at_[hidden]> wrote:
…
> I'm not finding a mention of "unix_clock" in the standard. What are you talking about?
Good catch — I meant `utc_clock` here (typo).
…
> So, if you want a time_t value for a utc_clock time_point, you need to first
> convert that time_point to system_clock and then call to_time_t on the latter.
> There's clock_cast in [time.clock.cast.fn] to do that. Note: This is non-trivial,
> because the number of UTC leap seconds that have elapsed at the
> indicated time point need to be queried from some sort of database.
Got it. This part was honestly difficult to figure out given the sparse documentation on the subject. I’ll update my demo program based on the insight you provided in your reply.
At the end of the day what I was trying to figure out was how to use the chrono portion of C++11 (and newer) in place of the C/POSIX libcall, `std::gmtime(..)`.
>> I tried using g++ 13.13.0
>
> That version number looks wrong.
Yeah. This was another typo (should have been `13.3.0`)...
I really appreciate the help!
Cheers,
-Enji
> On Jan 30, 2025, at 2:24 AM, Jens Maurer <jens.maurer_at_[hidden]> wrote:
…
> I'm not finding a mention of "unix_clock" in the standard. What are you talking about?
Good catch — I meant `utc_clock` here (typo).
…
> So, if you want a time_t value for a utc_clock time_point, you need to first
> convert that time_point to system_clock and then call to_time_t on the latter.
> There's clock_cast in [time.clock.cast.fn] to do that. Note: This is non-trivial,
> because the number of UTC leap seconds that have elapsed at the
> indicated time point need to be queried from some sort of database.
Got it. This part was honestly difficult to figure out given the sparse documentation on the subject. I’ll update my demo program based on the insight you provided in your reply.
At the end of the day what I was trying to figure out was how to use the chrono portion of C++11 (and newer) in place of the C/POSIX libcall, `std::gmtime(..)`.
>> I tried using g++ 13.13.0
>
> That version number looks wrong.
Yeah. This was another typo (should have been `13.3.0`)...
I really appreciate the help!
Cheers,
-Enji
Received on 2025-01-30 15:14:46