fmt
Loading...
Searching...
No Matches
chrono.cppm File Reference
module fmt

Formatters for std::chrono durations, time points and calendar types. More...

#include "fmt/macros.hpp"
#include <cerrno>
#include <climits>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <version>
import fmt:format;
import std;

Classes

struct  fmt::detail::UtcClock
struct  fmt::detail::LocalT
struct  fmt::detail::Null< T >
class  fmt::detail::Formatbuf< StreamBuf >
struct  fmt::detail::CodecvtResult< CodeUnit >
struct  fmt::detail::NullChronoSpecHandler< Derived >
class  fmt::detail::TmFormatChecker
struct  fmt::detail::HasTmGmtoff< T, typename >
struct  fmt::detail::HasTmGmtoff< T, void_t< decltype(T::tm_gmtoff)> >
struct  fmt::detail::HasTmZone< T, typename >
struct  fmt::detail::HasTmZone< T, void_t< decltype(T::tm_zone)> >
struct  fmt::detail::CountFractionalDigits< Num, Den, N, Enabled >
struct  fmt::detail::CountFractionalDigits< Num, Den, N, false >
class  fmt::detail::TmWriter< OutputIt, Char, Duration >
struct  fmt::detail::ChronoFormatChecker
struct  fmt::detail::MakeUnsignedOrUnchanged< T, INTEGRAL >
struct  fmt::detail::MakeUnsignedOrUnchanged< T, true >
class  fmt::detail::GetLocale
struct  fmt::detail::DurationFormatter< Char, Rep, Period >
class  fmt::Weekday
class  fmt::Day
class  fmt::Month
class  fmt::Year
class  fmt::YearMonthDay
struct  fmt::Formatter< Weekday, Char >
struct  fmt::Formatter< Day, Char >
struct  fmt::Formatter< Month, Char >
struct  fmt::Formatter< Year, Char >
struct  fmt::Formatter< YearMonthDay, Char >
struct  fmt::Formatter< std::chrono::duration< Rep, Period >, Char >
struct  fmt::Formatter< std::tm, Char >
struct  fmt::Formatter< SysTime< Duration >, Char >
struct  fmt::Formatter< UtcTime< Duration >, Char >
struct  fmt::Formatter< LocalTime< Duration >, Char >

Typedefs

template<typename Duration>
using fmt::SysTime
template<typename Duration>
using fmt::UtcTime = std::chrono::time_point<detail::UtcClock, Duration>
template<class Duration>
using fmt::LocalTime = std::chrono::time_point<detail::LocalT, Duration>
template<typename T, typename U>
using fmt::detail::IsSimilarArithmeticType

Enumerations

enum class  NumericSystem : int { kStandard = 0 , kAlternative = 1 }
enum class  PadType : int { kZero = 0 , kNone = 1 , kSpace = 2 }

Functions

auto fmt::detail::gmtime_r (...) -> Null<>
auto fmt::detail::gmtime_s (...) -> Null<>
auto fmt::detail::getClassicLocale () -> const std::locale &
template<typename CodeUnit>
auto fmt::detail::writeCodecvt (CodecvtResult< CodeUnit > &out, StringView in, const std::locale &loc) -> void
template<typename OutputIt>
auto fmt::detail::writeEncodedTmStr (OutputIt out, StringView in, const std::locale &loc) -> OutputIt
template<typename Char, typename OutputIt>
requires (!std::is_same<Char, char>::value)
auto fmt::detail::writeTmStr (OutputIt out, StringView sv, const std::locale &loc) -> OutputIt
template<typename Char, typename OutputIt>
requires (std::is_same<Char, char>::value)
auto fmt::detail::writeTmStr (OutputIt out, StringView sv, const std::locale &loc) -> OutputIt
template<typename Char>
auto fmt::detail::doWrite (Buffer< Char > &buf, const std::tm &time, const std::locale &loc, char format, char modifier) -> void
template<typename Char, typename OutputIt>
requires (!std::is_same<Char, char>::value)
auto fmt::detail::write (OutputIt out, const std::tm &time, const std::locale &loc, char format, char modifier=0) -> OutputIt
template<typename Char, typename OutputIt>
requires (std::is_same<Char, char>::value)
auto fmt::detail::write (OutputIt out, const std::tm &time, const std::locale &loc, char format, char modifier=0) -> OutputIt
void fmt::detail::throwDurationError ()
template<typename To, typename FromRep, typename FromPeriod>
requires (std::is_integral<FromRep>::value && std::is_integral<typename To::rep>::value)
auto fmt::detail::durationCast (std::chrono::duration< FromRep, FromPeriod > from) -> To
template<typename To, typename FromRep, typename FromPeriod>
requires (std::is_floating_point<FromRep>::value && std::is_floating_point<typename To::rep>::value)
auto fmt::detail::durationCast (std::chrono::duration< FromRep, FromPeriod > from) -> To
template<typename To, typename FromRep, typename FromPeriod>
requires (!IsSimilarArithmeticType<FromRep, typename To::rep>::value)
auto fmt::detail::durationCast (std::chrono::duration< FromRep, FromPeriod > from) -> To
template<typename Duration>
auto fmt::detail::toTimeT (SysTime< Duration > time_point) -> std::time_t
auto fmt::gmtime (std::time_t time) -> std::tm
template<typename Duration>
auto fmt::gmtime (SysTime< Duration > time_point) -> std::tm
auto fmt::detail::writeDigit2Separated (char *buf, unsigned a, unsigned b, unsigned c, char sep) -> void
template<typename Period>
constexpr auto fmt::detail::getUnits () -> const char *
template<typename OutputIt>
auto fmt::detail::writePadding (OutputIt out, PadType pad, int width) -> OutputIt
template<typename OutputIt>
auto fmt::detail::writePadding (OutputIt out, PadType pad) -> OutputIt
template<typename Char, typename Handler>
constexpr auto fmt::detail::parseChronoFormat (const Char *begin, const Char *end, Handler &&handler) -> const Char *
auto fmt::detail::tmWdayFullName (int wday) -> const char *
auto fmt::detail::tmWdayShortName (int wday) -> const char *
auto fmt::detail::tmMonFullName (int mon) -> const char *
auto fmt::detail::tmMonShortName (int mon) -> const char *
template<typename T>
requires (HasTmZone<T>::value)
auto fmt::detail::setTmZone (T &time, char *tz) -> bool
template<typename T>
requires (!HasTmZone<T>::value)
auto fmt::detail::setTmZone (T &, char *) -> bool
auto fmt::detail::utc () -> char *
template<typename T, typename Int>
requires (std::is_integral<T>::value)
auto fmt::detail::toNonnegativeInt (T value, Int upper) -> Int
template<typename T, typename Int>
requires (!std::is_integral<T>::value)
auto fmt::detail::toNonnegativeInt (T value, Int upper) -> Int
constexpr auto fmt::detail::pow10 (std::uint32_t n) -> long long
template<typename Char, typename OutputIt, typename Duration>
auto fmt::detail::writeFractionalSeconds (OutputIt &out, Duration d, int precision=-1) -> void
template<typename Duration>
auto fmt::detail::writeFloatingSeconds (MemoryBuffer &buf, Duration duration, int num_fractional_digits=-1) -> void
template<typename T>
requires (std::is_integral<T>::value && HasIsfinite<T>::value)
auto fmt::detail::isfinite (T) -> bool
template<typename T>
requires (std::is_integral<T>::value)
auto fmt::detail::mod (T x, int y) -> T
template<typename T>
requires (std::is_floating_point<T>::value)
auto fmt::detail::mod (T x, int y) -> T
template<typename Rep, typename Period>
requires (std::is_integral<Rep>::value)
auto fmt::detail::getMilliseconds (std::chrono::duration< Rep, Period > d) -> std::chrono::duration< Rep, std::milli >
template<typename Char, typename Rep, typename OutputIt>
requires (std::is_integral<Rep>::value)
auto fmt::detail::formatDurationValue (OutputIt out, Rep val, int) -> OutputIt
template<typename Char, typename Rep, typename OutputIt>
requires (std::is_floating_point<Rep>::value)
auto fmt::detail::formatDurationValue (OutputIt out, Rep val, int precision) -> OutputIt
template<typename Char, typename OutputIt>
auto fmt::detail::copyUnit (StringView unit, OutputIt out, Char) -> OutputIt
template<typename OutputIt>
auto fmt::detail::copyUnit (StringView unit, OutputIt out, wchar_t) -> OutputIt
template<typename Char, typename Period, typename OutputIt>
auto fmt::detail::formatDurationUnit (OutputIt out) -> OutputIt

Detailed Description

Formatters for std::chrono durations, time points and calendar types.

Interface partition fmt:chrono.

Typedef Documentation

◆ IsSimilarArithmeticType

template<typename T, typename U>
using fmt::detail::IsSimilarArithmeticType
Initial value:
bool_constant<(std::is_integral<T>::value &&
std::is_integral<U>::value) ||
(std::is_floating_point<T>::value &&
std::is_floating_point<U>::value)>

◆ SysTime

template<typename Duration>
using fmt::SysTime
Initial value:
std::chrono::time_point<std::chrono::system_clock, Duration>

Function Documentation

◆ gmtime() [1/2]

auto fmt::gmtime ( std::time_t time) -> std::tm
export

Converts a std::time_t into calendar time expressed in Coordinated Universal Time.

Unlike std::gmtime, this is thread-safe on most platforms: it uses gmtime_r or gmtime_s where available.

Parameters
timeseconds since the epoch.
Returns
the broken-down time.
Exceptions
fmt::format_errorif the value cannot be represented.

◆ gmtime() [2/2]

template<typename Duration>
auto fmt::gmtime ( SysTime< Duration > time_point) -> std::tm
export

Converts a sys_time into calendar time expressed in UTC.

Parameters
time_pointthe time point to convert.
Returns
the broken-down time.
Exceptions
fmt::format_errorif the value cannot be represented as time_t.