std::formatter<std::chrono::gps_time>

Header: <chrono>

Specialization of std::formatter that defines formatting rules for a std::chrono::gps_time.

# Declarations

template< class Duration, class CharT >
struct formatter<std::chrono::gps_time<Duration>, CharT>;

(since C++20)

# Example

#include <chrono>
#include <format>
#include <iostream>
 
int main()
{
    std::chrono::time_point<std::chrono::utc_clock> epoch;
 
    std::cout << std::format("The time of the Unix epoch was {0:%F}T{0:%R%z}.", epoch)
              << '\n';
}

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
P2372R3C++20formatter used the global locale or passed localedefault “C” locale is used when L is absent

# See also