std::chrono...k::from_utc(3)
π std::chrono::gps_clock::from_utc
okay so real talk, bestie β this page lives in the C++ Standard Library man pages, and it's the whole glow-up moment where a utc_time gets to be a gps_time. Same instant, different clock, no drama. β¨
πΈ NAME
std::chrono::gps_clock::from_utc β literally just std::chrono::gps_clock::from_utc. that's the name. it's giving self-titled debut album. π
π SYNOPSIS
template< class Duration >
static std::chrono::gps_time<std::common_type_t<Duration,
std::chrono::seconds>>
from_utc( const std::chrono::utc_time<Duration>& ) noexcept;
(since C++20) β yes, this is a C++20 girly, she's new here and she's thriving π¦
π DESCRIPTION
she converts the utc_time t into a gps_time that represents the exact same point in time. not a different moment. the same moment. just wearing a different clock's outfit. periodt. π₯
β RETURN VALUE
a std::chrono::gps_time representing the same point in time as t, computed as if by constructing a value of the return type from t.time_since_epoch() and subtracting 315964809s.
and bestie, in case you're wondering where that number came from (iykyk): 315964809 is the number of seconds between the epochs of the two clocks π
1980-01-06 00:00:00 UTCβ the epoch forgps_clockπ°οΈ1970-01-01 00:00:00 UTCβ the epoch forutc_clockπ°οΈ
so yeah, she's just doing epoch math with extra steps. iconic.
π¦ EXAMPLE
This section is incomplete Reason: no example
no example yet, bestie π not me showing up to the function with no demo. we're all waiting for the glow-up.
π SEE ALSO
to_utcβ converts agps_timetoutc_time(static) (public static member function) β the reverse trip, the return journey, the sequel πclock_castβ convert time points of one clock to another (C++20) (function template) β the general-purpose little matchmaker for clocks π«Ά
π CATEGORY
- Todo no example π
and that's the whole page, bestie! β¨ from http://cppreference.com, dated 2024.06.10 β mwah, go convert some timestamps ππ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms