std::chrono...k::from_utc(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’… 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 for gps_clock πŸ›°οΈ
  • 1970-01-01 00:00:00 UTC β€” the epoch for utc_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 a gps_time to utc_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