35#ifndef HAS_STRING_VIEW
36#if __cplusplus >= 201703 || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
37#define HAS_STRING_VIEW 1
39#define HAS_STRING_VIEW 0
71#pragma GCC diagnostic push
72#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 7)
73#pragma GCC diagnostic ignored "-Wpedantic"
77#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
84#pragma warning(disable : 4127)
94#define ONLY_C_LOCALE 0
97#if defined(_MSC_VER) && (!defined(__clang__) || (_MSC_VER < 1910))
99#ifndef _SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING
100#define _SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING
104#define CONSTDATA const
107#define NOEXCEPT _NOEXCEPT
110#define CONSTDATA constexpr const
111#define CONSTCD11 constexpr
112#define CONSTCD14 constexpr
113#define NOEXCEPT noexcept
116#elif defined(__SUNPRO_CC) && __SUNPRO_CC <= 0x5150
118#define CONSTDATA constexpr const
119#define CONSTCD11 constexpr
121#define NOEXCEPT noexcept
123#elif __cplusplus >= 201402
125#define CONSTDATA constexpr const
126#define CONSTCD11 constexpr
127#define CONSTCD14 constexpr
128#define NOEXCEPT noexcept
131#define CONSTDATA constexpr const
132#define CONSTCD11 constexpr
134#define NOEXCEPT noexcept
137#ifndef HAS_UNCAUGHT_EXCEPTIONS
138#if __cplusplus >= 201703 || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
139#define HAS_UNCAUGHT_EXCEPTIONS 1
141#define HAS_UNCAUGHT_EXCEPTIONS 0
146#if __cplusplus >= 201703 || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
162template <
typename R1,
typename R2>
165template <
typename R1,
typename R2>
176 duration<int, detail::ratio_multiply<std::ratio<24>, std::chrono::hours::period>>;
179 std::chrono::duration<int, detail::ratio_multiply<std::ratio<7>, days::period>>;
182 std::chrono::duration<int,
186 std::chrono::duration<int, detail::ratio_divide<years::period, std::ratio<12>>>;
190template <
class Duration>
191using sys_time = std::chrono::time_point<std::chrono::system_clock, Duration>;
199template <
class Duration>
200using local_time = std::chrono::time_point<local_t, Duration>;
341template <class CharT, class Traits>
342std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os,
379template <class CharT, class Traits>
380std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os,
425template <
class CharT,
class Traits>
426std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,
463 template <class CharT, class Traits>
464 friend std::basic_ostream<CharT, Traits>&
465 operator<<(std::basic_ostream<CharT, Traits>& os, const
weekday& wd);
477template <class CharT, class Traits>
478std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os,
485 unsigned char wd_ : 4;
486 unsigned char index_ : 4;
500template <class CharT, class Traits>
501std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os,
520template <
class CharT,
class Traits>
521std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,
545 template <class = detail::unspecified_month_disambiguator>
547 template <class = detail::unspecified_month_disambiguator>
562template <class = detail::unspecified_month_disambiguator>
564template <class = detail::unspecified_month_disambiguator>
566template <class = detail::unspecified_month_disambiguator>
574template <class CharT, class Traits>
575std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os,
602template <class CharT, class Traits>
603std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os,
626template <
class CharT,
class Traits>
627std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,
650template <
class CharT,
class Traits>
651std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,
676template <
class CharT,
class Traits>
677std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,
698 template <
class = detail::unspecified_month_disambiguator>
700 template <
class = detail::unspecified_month_disambiguator>
725template <class = detail::unspecified_month_disambiguator>
727template <class = detail::unspecified_month_disambiguator>
729template <class = detail::unspecified_month_disambiguator>
735template <class CharT, class Traits>
736std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os,
750 template <
class = detail::unspecified_month_disambiguator>
752 template <
class = detail::unspecified_month_disambiguator>
780template <
class = detail::unspecified_month_disambiguator>
784template <
class = detail::unspecified_month_disambiguator>
794template <
class = detail::unspecified_month_disambiguator>
801template <
class CharT,
class Traits>
802std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,
821 template <
class = detail::unspecified_month_disambiguator>
823 template <
class = detail::unspecified_month_disambiguator>
848template <class = detail::unspecified_month_disambiguator>
852template <class = detail::unspecified_month_disambiguator>
862template <class = detail::unspecified_month_disambiguator>
869template <class CharT, class Traits>
870std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os,
886 template <
class = detail::unspecified_month_disambiguator>
888 template <
class = detail::unspecified_month_disambiguator>
914template <
class = detail::unspecified_month_disambiguator>
918template <
class = detail::unspecified_month_disambiguator>
930template <
class = detail::unspecified_month_disambiguator>
938template <
class CharT,
class Traits>
939std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,
942#if !defined(_MSC_VER) || (_MSC_VER >= 1900)
943inline namespace literals {
974template <
class T,
class = std::
void_t<>>
975struct is_clock : std::false_type {
980 std::void_t<decltype(T::now()),
983 typename T::duration,
984 typename T::time_point,
985 decltype(T::is_steady)>> : std::true_type {
989inline constexpr bool is_clock_v = is_clock<T>::value;
1000template <
class CharT,
class Traits = std::
char_traits<CharT>>
1004 std::basic_ios<CharT, Traits>&
is_;
1009 std::basic_ostream<CharT, Traits>*
tie_;
1017 is_.precision(precision_);
1030 precision_(is.precision()),
1031 width_(is.
width(0)),
1032 tie_(is.tie(nullptr)),
1035 if (tie_ !=
nullptr)
1040template <
class CharT,
class Traits = std::
char_traits<CharT>>
1046 if ((this->flags_ & std::ios::unitbuf) &&
1048 std::uncaught_exceptions() == 0 &&
1050 !std::uncaught_exception() &&
1053 this->is_.rdbuf()->pubsync();
1067 static const int digits = std::numeric_limits<T>::digits;
1068 using type =
typename std::conditional < digits < 32, std::int32_t,
1069 typename std::conditional<digits<64,
1071#ifdef __SIZEOF_INT128__
1081 typename std::enable_if<!std::chrono::treat_as_floating_point<T>::value, T>::type
1089 typename std::enable_if<std::chrono::treat_as_floating_point<T>::value, T>::type
1092 using std::numeric_limits;
1094 CONSTDATA auto digits = numeric_limits<T>::digits;
1095 static_assert(digits < numeric_limits<I>::digits,
"");
1096 CONSTDATA auto max = I{ 1 } << (digits - 1);
1098 const auto negative =
t < T{ 0 };
1099 if (min <=
t &&
t <= max &&
t != 0 &&
t ==
t) {
1100 t =
static_cast<T
>(
static_cast<I
>(
t));
1101 if (
t == 0 && negative)
1107template <std::
intmax_t Xp, std::
intmax_t Yp>
1112template <std::
intmax_t Xp>
1114 static const std::intmax_t value = Xp;
1119 static const std::intmax_t value = 1;
1122template <
class R1,
class R2>
1127 static const std::intmax_t n1 = R1::num / gcd_n1_n2;
1128 static const std::intmax_t d1 =
R1::den / gcd_d1_d2;
1129 static const std::intmax_t n2 = R2::num / gcd_n1_n2;
1130 static const std::intmax_t d2 =
R2::den / gcd_d1_d2;
1131#ifdef __cpp_constexpr
1132 static const std::intmax_t max = std::numeric_limits<std::intmax_t>::max();
1134 static const std::intmax_t max = LLONG_MAX;
1137 template <std::
intmax_t Xp, std::
intmax_t Yp,
bool overflow>
1140 static const std::intmax_t value = Xp * Yp;
1143 template <std::
intmax_t Xp, std::
intmax_t Yp>
1144 struct mul<Xp, Yp, true> {
1145 static const std::intmax_t value = 1;
1149 static const bool value = (n1 <= max / d2) && (n2 <= max / d1);
1150 typedef std::ratio<mul<n1, d2, !value>::value, mul<n2, d1, !value>::value>
type;
1156template <
class To,
class Rep,
class Period>
1158 typename std::enable_if<detail::no_overflow<Period, typename To::period>::value,
1160 trunc(
const std::chrono::duration<Rep, Period>& d)
1165template <
class To,
class Rep,
class Period>
1167 typename std::enable_if<!detail::no_overflow<Period, typename To::period>::value,
1169 trunc(
const std::chrono::duration<Rep, Period>& d)
1171 using std::chrono::duration;
1172 using std::chrono::duration_cast;
1173 using rep =
typename std::common_type<Rep, typename To::rep>::type;
1175 duration_cast<To>(duration_cast<duration<rep>>(d)).
count()) };
1178#ifndef HAS_CHRONO_ROUNDING
1179#if defined(_MSC_FULL_VER) && \
1180 (_MSC_FULL_VER >= 190023918 || (_MSC_FULL_VER >= 190000000 && defined(__clang__)))
1181#define HAS_CHRONO_ROUNDING 1
1182#elif defined(__cpp_lib_chrono) && __cplusplus > 201402 && __cpp_lib_chrono >= 201510
1183#define HAS_CHRONO_ROUNDING 1
1184#elif defined(_LIBCPP_VERSION) && __cplusplus > 201402 && _LIBCPP_VERSION >= 3800
1185#define HAS_CHRONO_ROUNDING 1
1187#define HAS_CHRONO_ROUNDING 0
1191#if HAS_CHRONO_ROUNDING == 0
1194template <
class To,
class Rep,
class Period>
1196 typename std::enable_if<detail::no_overflow<Period, typename To::period>::value,
1198 floor(
const std::chrono::duration<Rep, Period>& d)
1200 auto t = trunc<To>(d);
1206template <
class To,
class Rep,
class Period>
1208 typename std::enable_if<!detail::no_overflow<Period, typename To::period>::value,
1210 floor(
const std::chrono::duration<Rep, Period>& d)
1212 using rep =
typename std::common_type<Rep, typename To::rep>::type;
1213 return floor<To>(
floor<std::chrono::duration<rep>>(d));
1217template <
class To,
class Rep,
class Period>
1220 auto t0 = floor<To>(d);
1221 auto t1 = t0 + To{ 1 };
1222 if (t1 == To{ 0 } && t0 < To{ 0 })
1224 auto diff0 = d - t0;
1225 auto diff1 = t1 - d;
1226 if (diff0 == diff1) {
1227 if (t0 - trunc<To>(t0 / 2) * 2 == To{ 0 })
1237template <
class To,
class Rep,
class Period>
1240 auto t = trunc<To>(d);
1248 class =
typename std::enable_if<std::numeric_limits<Rep>::is_signed>::type>
1249CONSTCD11 std::chrono::duration<Rep, Period>
abs(std::chrono::duration<Rep, Period> d)
1251 return d >= d.zero() ? d : -d;
1255template <
class To,
class Clock,
class FromDuration>
1256CONSTCD11 inline std::chrono::time_point<Clock, To>
1257floor(
const std::chrono::time_point<Clock, FromDuration>& tp)
1259 using std::chrono::time_point;
1260 return time_point<Clock, To>{ date::floor<To>(tp.time_since_epoch()) };
1264template <
class To,
class Clock,
class FromDuration>
1265CONSTCD11 inline std::chrono::time_point<Clock, To>
1266round(
const std::chrono::time_point<Clock, FromDuration>& tp)
1268 using std::chrono::time_point;
1269 return time_point<Clock, To>{ round<To>(tp.time_since_epoch()) };
1273template <
class To,
class Clock,
class FromDuration>
1274CONSTCD11 inline std::chrono::time_point<Clock, To>
1275ceil(
const std::chrono::time_point<Clock, FromDuration>& tp)
1277 using std::chrono::time_point;
1278 return time_point<Clock, To>{ ceil<To>(tp.time_since_epoch()) };
1292template <
class To,
class Rep,
class Period>
1294 enable_if<!std::chrono::treat_as_floating_point<typename To::rep>::value, To>::type
1295 round_i(
const std::chrono::duration<Rep, Period>& d)
1297 return round<To>(d);
1300template <
class To,
class Rep,
class Period>
1302 typename std::enable_if<std::chrono::treat_as_floating_point<typename To::rep>::value,
1304 round_i(
const std::chrono::duration<Rep, Period>& d)
1309template <
class To,
class Clock,
class FromDuration>
1310CONSTCD11 inline std::chrono::time_point<Clock, To>
1311round_i(
const std::chrono::time_point<Clock, FromDuration>& tp)
1313 using std::chrono::time_point;
1314 return time_point<Clock, To>{ round_i<To>(tp.time_since_epoch()) };
1320template <
class To,
class Clock,
class FromDuration>
1321CONSTCD11 inline std::chrono::time_point<Clock, To>
1322trunc(
const std::chrono::time_point<Clock, FromDuration>& tp)
1324 using std::chrono::time_point;
1325 return time_point<Clock, To>{ trunc<To>(tp.time_since_epoch()) };
1369 return static_cast<unsigned>(x) ==
static_cast<unsigned>(y);
1378 return static_cast<unsigned>(x) <
static_cast<unsigned>(y);
1393 return days{
static_cast<days::rep
>(
static_cast<unsigned>(x) -
1394 static_cast<unsigned>(y)) };
1400 return day{
static_cast<unsigned>(x) +
static_cast<unsigned>(y.count()) };
1411template <
class CharT,
class Traits>
1412std::basic_ostream<CharT, Traits>&
low_level_fmt(std::basic_ostream<CharT, Traits>& os,
1419 os << static_cast<unsigned>(d);
1425template <
class CharT,
class Traits>
1426inline std::basic_ostream<CharT, Traits>&
1427operator<<(std::basic_ostream<CharT, Traits>& os,
const day& d)
1431 os <<
" is not a valid day";
1481 return static_cast<unsigned>(x) ==
static_cast<unsigned>(y);
1490 return static_cast<unsigned>(x) <
static_cast<unsigned>(y);
1505 auto const d =
static_cast<unsigned>(x) -
static_cast<unsigned>(y);
1506 return months(d <= 11 ? d : d + 12);
1512 auto const mu =
static_cast<long long>(
static_cast<unsigned>(x)) + y.count() - 1;
1513 auto const yr = (mu >= 0 ? mu : mu - 11) / 12;
1514 return month{
static_cast<unsigned>(mu - yr * 12 + 1) };
1525template <
class CharT,
class Traits>
1526std::basic_ostream<CharT, Traits>&
low_level_fmt(std::basic_ostream<CharT, Traits>& os,
1530 CharT fmt[] = {
'%',
'b', 0 };
1531 os <<
format(os.getloc(), fmt, m);
1533 os << static_cast<unsigned>(m);
1539template <
class CharT,
class Traits>
1540inline std::basic_ostream<CharT, Traits>&
1541operator<<(std::basic_ostream<CharT, Traits>& os,
const month& m)
1545 os <<
" is not a valid month";
1590 return y_ % 4 == 0 && (y_ % 100 != 0 || y_ % 400 == 0);
1601 return static_cast<int>(x) ==
static_cast<int>(y);
1610 return static_cast<int>(x) <
static_cast<int>(y);
1625 return years{
static_cast<int>(x) -
static_cast<int>(y) };
1631 return year{
static_cast<int>(x) + y.count() };
1640 return year{
static_cast<int>(x) - y.count() };
1645template <
class CharT,
class Traits>
1646std::basic_ostream<CharT, Traits>&
low_level_fmt(std::basic_ostream<CharT, Traits>& os,
1652 os.width(4 + (y <
year{ 0 }));
1653 os.imbue(std::locale::classic());
1654 os << static_cast<int>(y);
1660template <
class CharT,
class Traits>
1661inline std::basic_ostream<CharT, Traits>&
1662operator<<(std::basic_ostream<CharT, Traits>& os,
const year& y)
1666 os <<
" is not a valid year";
1673inline unsigned char weekday::weekday_from_days(
int z)
NOEXCEPT
1675 auto u =
static_cast<unsigned>(z);
1676 return static_cast<unsigned char>(z >= -4 ? (
u + 4) % 7 :
u % 7);
1681 : wd_(
static_cast<decltype(wd_)
>(wd != 7 ? wd : 0))
1687 : wd_(weekday_from_days(dp.time_since_epoch().count()))
1693 : wd_(weekday_from_days(dp.time_since_epoch().count()))
1742 return unsigned{ ((wd_ == 0
u) ? 7u : wd_) };
1748 return x.wd_ == y.wd_;
1757 auto const wdu = x.wd_ - y.wd_;
1758 auto const wk = (wdu >= 0 ? wdu : wdu - 6) / 7;
1759 return days{ wdu - wk * 7 };
1765 auto const wdu =
static_cast<long long>(
static_cast<unsigned>(x.wd_)) + y.count();
1766 auto const wk = (wdu >= 0 ? wdu : wdu - 6) / 7;
1767 return weekday{
static_cast<unsigned>(wdu - wk * 7) };
1778template <
class CharT,
class Traits>
1779std::basic_ostream<CharT, Traits>&
low_level_fmt(std::basic_ostream<CharT, Traits>& os,
1783 CharT fmt[] = {
'%',
'a', 0 };
1792template <
class CharT,
class Traits>
1793inline std::basic_ostream<CharT, Traits>&
1794operator<<(std::basic_ostream<CharT, Traits>& os,
const weekday& wd)
1798 os <<
" is not a valid weekday";
1802#if !defined(_MSC_VER) || (_MSC_VER >= 1900)
1803inline namespace literals {
1808 return date::day{
static_cast<unsigned>(d) };
1841#if !defined(_MSC_VER) || (_MSC_VER >= 1900)
1879 return weekday().
ok() && 1 <= index_ && index_ <= 5;
1883#pragma GCC diagnostic push
1884#pragma GCC diagnostic ignored "-Wconversion"
1889 : wd_(
static_cast<decltype(wd_)
>(
static_cast<unsigned>(wd.wd_))),
1890 index_(
static_cast<decltype(index_)
>(index))
1895#pragma GCC diagnostic pop
1900template <
class CharT,
class Traits>
1901std::basic_ostream<CharT, Traits>&
low_level_fmt(std::basic_ostream<CharT, Traits>& os,
1909template <
class CharT,
class Traits>
1910inline std::basic_ostream<CharT, Traits>&
1911operator<<(std::basic_ostream<CharT, Traits>& os,
const weekday_indexed& wdi)
1915 os <<
" is not a valid weekday_indexed";
1922 return { *
this, index };
1928 return x.weekday() == y.weekday() && x.index() == y.index();
1946 return x.weekday() == y.weekday();
1957template <
class CharT,
class Traits>
1958std::basic_ostream<CharT, Traits>&
low_level_fmt(std::basic_ostream<CharT, Traits>& os,
1966template <
class CharT,
class Traits>
1967inline std::basic_ostream<CharT, Traits>&
1968operator<<(std::basic_ostream<CharT, Traits>& os,
const weekday_last& wdl)
1972 os <<
" is not a valid weekday_last";
2025 return x.year() == y.year() && x.month() == y.month();
2037 return x.year() < y.year() ? true
2038 : (x.year() > y.year() ? false : (x.month() < y.month()));
2059 auto dmi =
static_cast<int>(
static_cast<unsigned>(ym.month())) - 1 + dm.count();
2060 auto dy = (dmi >= 0 ? dmi : dmi - 11) / 12;
2061 dmi = dmi - dy * 12 + 1;
2062 return (ym.year() +
years(dy)) /
month(
static_cast<unsigned>(dmi));
2080 return (x.year() - y.year()) +
2081 months(
static_cast<unsigned>(x.month()) -
static_cast<unsigned>(y.month()));
2087 return (ym.year() + dy) / ym.month();
2104template <
class CharT,
class Traits>
2105std::basic_ostream<CharT, Traits>&
low_level_fmt(std::basic_ostream<CharT, Traits>& os,
2114template <
class CharT,
class Traits>
2115inline std::basic_ostream<CharT, Traits>&
2116operator<<(std::basic_ostream<CharT, Traits>& os,
const year_month& ym)
2120 os <<
" is not a valid year_month";
2142 return m_.
ok() &&
date::day{ 1 } <= d_ && d_ <= d[static_cast<unsigned>(m_) - 1];
2148 return x.month() == y.month() && x.day() == y.day();
2160 return x.month() < y.month() ? true
2161 : (x.month() > y.month() ? false : (x.day() < y.day()));
2181template <
class CharT,
class Traits>
2182std::basic_ostream<CharT, Traits>&
low_level_fmt(std::basic_ostream<CharT, Traits>& os,
2191template <
class CharT,
class Traits>
2192inline std::basic_ostream<CharT, Traits>&
2193operator<<(std::basic_ostream<CharT, Traits>& os,
const month_day& md)
2197 os <<
" is not a valid month_day";
2210 return x.month() == y.month();
2222 return x.month() < y.month();
2245template <
class CharT,
class Traits>
2246std::basic_ostream<CharT, Traits>&
low_level_fmt(std::basic_ostream<CharT, Traits>& os,
2254template <
class CharT,
class Traits>
2255inline std::basic_ostream<CharT, Traits>&
2256operator<<(std::basic_ostream<CharT, Traits>& os,
const month_day_last& mdl)
2260 os <<
" is not a valid month_day_last";
2284 return x.month() == y.month() && x.weekday_indexed() == y.weekday_indexed();
2295template <
class CharT,
class Traits>
2296std::basic_ostream<CharT, Traits>&
low_level_fmt(std::basic_ostream<CharT, Traits>& os,
2305template <
class CharT,
class Traits>
2306inline std::basic_ostream<CharT, Traits>&
2307operator<<(std::basic_ostream<CharT, Traits>& os,
const month_weekday& mwd)
2311 os <<
" is not a valid month_weekday";
2336 return x.month() == y.month() && x.weekday_last() == y.weekday_last();
2347template <
class CharT,
class Traits>
2348std::basic_ostream<CharT, Traits>&
low_level_fmt(std::basic_ostream<CharT, Traits>& os,
2357template <
class CharT,
class Traits>
2358inline std::basic_ostream<CharT, Traits>&
2359operator<<(std::basic_ostream<CharT, Traits>& os,
const month_weekday_last& mwdl)
2363 os <<
" is not a valid month_weekday_last";
2410 return mdl_.month();
2427 ? d[
static_cast<unsigned>(
month()) - 1]
2450 return x.year() == y.year() && x.month_day_last() == y.month_day_last();
2463 return x.year() < y.year()
2465 : (x.year() > y.year() ? false
2466 : (x.month_day_last() < y.month_day_last()));
2491template <
class CharT,
class Traits>
2492std::basic_ostream<CharT, Traits>&
low_level_fmt(std::basic_ostream<CharT, Traits>& os,
2501template <
class CharT,
class Traits>
2502inline std::basic_ostream<CharT, Traits>&
2503operator<<(std::basic_ostream<CharT, Traits>& os,
const year_month_day_last& ymdl)
2507 os <<
" is not a valid year_month_day_last";
2515 return (ymdl.year() / ymdl.month() + dm) /
last;
2529 return ymdl + (-dm);
2536 return { ymdl.year() + dy, ymdl.month_day_last() };
2550 return ymdl + (-dy);
2619 static_assert(std::numeric_limits<unsigned>::digits >= 18,
2620 "This algorithm has not been ported to a 16 bit unsigned integer");
2621 static_assert(std::numeric_limits<int>::digits >= 20,
2622 "This algorithm has not been ported to a 16 bit signed integer");
2623 auto const y =
static_cast<int>(y_) - (m_ <=
February);
2624 auto const m =
static_cast<unsigned>(m_);
2625 auto const d =
static_cast<unsigned>(d_);
2626 auto const era = (y >= 0 ? y : y - 399) / 400;
2627 auto const yoe =
static_cast<unsigned>(y - era * 400);
2628 auto const doy = (153 * (m > 2 ? m - 3 : m + 9) + 2) / 5 + d - 1;
2629 auto const doe = yoe * 365 + yoe / 4 - yoe / 100 + doy;
2630 return days{ era * 146097 +
static_cast<int>(doe) - 719468 };
2648 if (!(y_.
ok() && m_.
ok()))
2656 return x.year() == y.year() && x.month() == y.month() && x.day() == y.day();
2668 return x.year() < y.year()
2670 : (x.year() > y.year()
2672 : (x.month() < y.month()
2674 : (x.month() > y.month() ? false : (x.day() < y.day()))));
2695template <
class CharT,
class Traits>
2696inline std::basic_ostream<CharT, Traits>&
2697operator<<(std::basic_ostream<CharT, Traits>& os,
const year_month_day& ymd)
2699 detail::save_ostream<CharT, Traits> _(os);
2702 os.imbue(std::locale::classic());
2703 os << static_cast<int>(ymd.year()) <<
'-';
2705 os << static_cast<unsigned>(ymd.month()) <<
'-';
2707 os << static_cast<unsigned>(ymd.day());
2709 os <<
" is not a valid year_month_day";
2714inline year_month_day year_month_day::from_days(
days dp)
NOEXCEPT
2716 static_assert(std::numeric_limits<unsigned>::digits >= 18,
2717 "This algorithm has not been ported to a 16 bit unsigned integer");
2718 static_assert(std::numeric_limits<int>::digits >= 20,
2719 "This algorithm has not been ported to a 16 bit signed integer");
2720 auto const z = dp.count() + 719468;
2721 auto const era = (z >= 0 ? z : z - 146096) / 146097;
2722 auto const doe =
static_cast<unsigned>(z - era * 146097);
2723 auto const yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365;
2724 auto const y =
static_cast<days::rep
>(yoe) + era * 400;
2725 auto const doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
2726 auto const mp = (5 * doy + 2) / 153;
2727 auto const d = doy - (153 * mp + 2) / 5 + 1;
2728 auto const m = mp < 10 ? mp + 3 : mp - 9;
2736 return (ymd.year() / ymd.month() + dm) / ymd.day();
2756 return (ymd.year() + dy) / ymd.month() / ymd.day();
2857 if (wdi_.
index() <= 4)
2861 return static_cast<unsigned>(d2.count()) <=
2862 static_cast<unsigned>((y_ / m_ /
last).day());
2870 auto const ymd = year_month_day(dp);
2871 return { ymd.year(),
2873 wd[(
static_cast<unsigned>(ymd.day()) - 1) / 7 + 1] };
2877inline days year_month_weekday::to_days() const
NOEXCEPT
2881 .time_since_epoch();
2887 return x.year() == y.year() && x.month() == y.month() &&
2888 x.weekday_indexed() == y.weekday_indexed();
2897template <
class CharT,
class Traits>
2898inline std::basic_ostream<CharT, Traits>&
2899operator<<(std::basic_ostream<CharT, Traits>& os,
const year_month_weekday& ymwdi)
2905 os <<
" is not a valid year_month_weekday";
2913 return (ymwd.year() / ymwd.month() + dm) / ymwd.weekday_indexed();
2927 return ymwd + (-dm);
2934 return { ymwd.year() + dy, ymwd.month(), ymwd.weekday_indexed() };
2948 return ymwd + (-dy);
3000 return wdl_.weekday();
3024 return y_.
ok() && m_.
ok() && wdl_.ok();
3028inline days year_month_weekday_last::to_days() const
NOEXCEPT
3038 return x.year() == y.year() && x.month() == y.month() &&
3039 x.weekday_last() == y.weekday_last();
3049template <
class CharT,
class Traits>
3050inline std::basic_ostream<CharT, Traits>&
3051operator<<(std::basic_ostream<CharT, Traits>& os,
const year_month_weekday_last& ymwdl)
3057 os <<
" is not a valid year_month_weekday_last";
3065 return (ymwdl.year() / ymwdl.month() + dm) / ymwdl.weekday_last();
3079 return ymwdl + (-dm);
3086 return { ymwdl.year() + dy, ymwdl.month(), ymwdl.weekday_last() };
3100 return ymwdl + (-dy);
3111 return y /
month(
static_cast<unsigned>(m));
3125 return m /
day(
static_cast<unsigned>(d));
3131 return month(
static_cast<unsigned>(m)) / d;
3150 return month(
static_cast<unsigned>(m)) /
last;
3173 return month(
static_cast<unsigned>(m)) / wdi;
3199 return month(
static_cast<unsigned>(m)) / wdl;
3213 return { ym.year(), ym.month(), d };
3219 return ym /
day(
static_cast<unsigned>(d));
3225 return y / md.month() / md.day();
3231 return year(y) / md;
3243 return year(y) / md;
3263 return year(y) / mdl;
3275 return year(y) / mdl;
3284 return { ym.year(), ym.month(), wdi };
3290 return { y, mwd.month(), mwd.weekday_indexed() };
3296 return year(y) / mwd;
3308 return year(y) / mwd;
3317 return { ym.year(), ym.month(), wdl };
3324 return { y, mwdl.month(), mwdl.weekday_last() };
3330 return year(y) / mwdl;
3343 return year(y) / mwdl;
3346template <
class Duration>
3349template <
class CharT,
class Traits,
class Duration>
3350std::basic_ostream<CharT, Traits>&
3351to_stream(std::basic_ostream<CharT, Traits>& os,
3353 const fields<Duration>& fds,
3354 const std::string* abbrev =
nullptr,
3355 const std::chrono::seconds* offset_sec =
nullptr);
3357template <
class CharT,
class Traits,
class Duration,
class Alloc>
3358std::basic_istream<CharT, Traits>&
3361 fields<Duration>& fds,
3362 std::basic_string<CharT, Traits, Alloc>* abbrev =
nullptr,
3363 std::chrono::minutes* offset =
nullptr);
3382template <std::uint64_t n,
3385 bool should_continue = n % d != 0 && (w < 19)>
3387 static_assert(d > 0,
"width called with zero denominator");
3391template <std::u
int64_t n, std::u
int64_t d,
unsigned w>
3396template <
unsigned exp>
3402 static CONSTDATA std::uint64_t value = h * h * (exp % 2 ? 10 : 1);
3410template <
class Duration>
3413 using CT =
typename std::common_type<Duration, std::chrono::seconds>::type;
3414 using rep =
typename CT::rep;
3421 std::chrono::duration<rep, std::ratio<1, static_pow10<width>::value>>;
3424 std::chrono::seconds s_;
3431 : s_(std::chrono::duration_cast<std::chrono::seconds>(d)),
3432 sub_s_(std::chrono::duration_cast<precision>(d - s_))
3444 return sub_s_ < std::chrono::seconds{ 1 } && s_ < std::chrono::minutes{ 1 };
3447 template <
class CharT,
class Traits>
3448 friend std::basic_ostream<CharT, Traits>&
3451 return x.
print(os, std::chrono::treat_as_floating_point<rep>{});
3454 template <
class CharT,
class Traits>
3455 std::basic_ostream<CharT, Traits>&
print(std::basic_ostream<CharT, Traits>& os,
3456 std::true_type)
const
3459 std::chrono::duration<rep> d = s_ + sub_s_;
3460 if (d < std::chrono::seconds{ 10 })
3462 os.precision(
width + 6);
3463 os << std::fixed << d.count();
3467 template <
class CharT,
class Traits>
3468 std::basic_ostream<CharT, Traits>&
print(std::basic_ostream<CharT, Traits>& os,
3469 std::false_type)
const
3478 os << std::use_facet<std::numpunct<CharT>>(os.getloc()).decimal_point();
3483 os.imbue(std::locale::classic());
3485 os << sub_s_.count();
3491template <
class Rep,
class Period>
3492inline CONSTCD11 typename std::enable_if<std::numeric_limits<Rep>::is_signed,
3493 std::chrono::duration<Rep, Period>>::type
3494abs(std::chrono::duration<Rep, Period> d)
3496 return d >= d.zero() ? +d : -d;
3499template <
class Rep,
class Period>
3500inline CONSTCD11 typename std::enable_if<!std::numeric_limits<Rep>::is_signed,
3501 std::chrono::duration<Rep, Period>>::type
3502abs(std::chrono::duration<Rep, Period> d)
3509template <
class Duration>
3513 typename std::common_type<Duration, std::chrono::seconds>::type>;
3515 std::chrono::hours h_;
3516 std::chrono::minutes m_;
3527 : h_(std::chrono::duration_cast<std::chrono::hours>(
detail::abs(d))),
3528 m_(std::chrono::duration_cast<std::chrono::minutes>(
detail::abs(d)) - h_),
3530 neg_(d < Duration::zero())
3547 return (s_.
to_duration() + m_ + h_) * (1 - 2 * neg_);
3552 return !neg_ && h_ <
days{ 1 } && m_ < std::chrono::hours{ 1 } &&
3557 template <
class charT,
class traits>
3558 friend std::basic_ostream<charT, traits>&
3563 if (tod.h_ < std::chrono::hours{ 10 })
3565 os << tod.h_.count() <<
':';
3566 if (tod.m_ < std::chrono::minutes{ 10 })
3568 os << tod.m_.count() <<
':' << tod.s_;
3572 template <
class CharT,
class Traits,
class Duration2>
3573 friend std::basic_ostream<CharT, Traits>&
3577 const std::string* abbrev,
3578 const std::chrono::seconds* offset_sec);
3580 template <
class CharT,
class Traits,
class Duration2,
class Alloc>
3581 friend std::basic_istream<CharT, Traits>&
3585 std::basic_string<CharT, Traits, Alloc>* abbrev,
3586 std::chrono::minutes* offset);
3591 using std::chrono::hours;
3592 return hours{ 0 } <= h && h < hours{ 12 };
3597 using std::chrono::hours;
3598 return hours{ 12 } <= h && h < hours{ 24 };
3603 using std::chrono::hours;
3604 if (h < hours{ 12 }) {
3605 if (h == hours{ 0 })
3608 if (h != hours{ 12 })
3609 h = h - hours{ 12 };
3616 using std::chrono::hours;
3618 if (h != hours{ 12 })
3619 h = h + hours{ 12 };
3620 }
else if (h == hours{ 12 })
3625template <
class Duration>
3628template <
class Rep,
class Period>
3635template <
class CharT,
class Traits,
class Duration>
3636inline typename std::enable_if<
3637 std::ratio_less<typename Duration::period, days::period>::value,
3638 std::basic_ostream<CharT, Traits>&>::type
3641 auto const dp = date::floor<days>(tp);
3645template <
class CharT,
class Traits>
3646inline std::basic_ostream<CharT, Traits>&
3649 return os << year_month_day(dp);
3652template <
class CharT,
class Traits,
class Duration>
3653inline std::basic_ostream<CharT, Traits>&
3654operator<<(std::basic_ostream<CharT, Traits>& os,
const local_time<Duration>& ut)
3656 return (os << sys_time<Duration>{ ut.time_since_epoch() });
3661template <
class CharT, std::
size_t N>
3664template <
class CharT1,
class CharT2, std::
size_t N1, std::
size_t N2>
3666 typename std::conditional<
sizeof(CharT2) <=
sizeof(CharT1), CharT1, CharT2>::type,
3671template <
class CharT, std::
size_t N>
3679 using const_iterator =
const CharT*;
3681 string_literal(string_literal
const&) =
default;
3682 string_literal& operator=(string_literal
const&) =
delete;
3684 template <std::size_t N1 = 2, class = typename std::enable_if<N1 == N>::type>
3689 template <std::size_t N1 = 3, class = typename std::enable_if<N1 == N>::type>
3694 template <std::size_t N1 = 4, class = typename std::enable_if<N1 == N>::type>
3695 CONSTCD11 string_literal(CharT c1, CharT c2, CharT c3)
NOEXCEPT : p_{ c1, c2, c3 }
3701 for (std::size_t
i = 0;
i < N; ++
i)
3705 template <
class U = CharT,
class =
typename std::enable_if<(1 < sizeof(U))>::type>
3706 CONSTCD14
string_literal(const
char (&a)[N]) NOEXCEPT : p_{}
3708 for (std::
size_t i = 0; i < N; ++i)
3712 template <
class CharT2,
3713 class =
typename std::enable_if<!std::is_same<CharT2, CharT>::value>::type>
3716 for (std::size_t
i = 0;
i < N; ++
i)
3726 CONSTCD11 CharT
const& operator[](std::size_t n)
const NOEXCEPT {
return p_[n]; }
3728 template <
class Traits>
3729 friend std::basic_ostream<CharT, Traits>&
3730 operator<<(std::basic_ostream<CharT, Traits>& os,
const string_literal&
s)
3735 template <
class CharT1,
class CharT2, std::
size_t N1, std::
size_t N2>
3737 typename std::conditional<
sizeof(CharT2) <=
sizeof(CharT1), CharT1, CharT2>::type,
3739 operator+(
const string_literal<CharT1, N1>& x,
3740 const string_literal<CharT2, N2>& y)
NOEXCEPT;
3743template <
class CharT>
3744CONSTCD11 inline string_literal<CharT, 3>
3745operator+(
const string_literal<CharT, 2>& x,
const string_literal<CharT, 2>& y)
NOEXCEPT
3747 return string_literal<CharT, 3>(x[0], y[0]);
3750template <
class CharT>
3751CONSTCD11 inline string_literal<CharT, 4>
3752operator+(
const string_literal<CharT, 3>& x,
const string_literal<CharT, 2>& y)
NOEXCEPT
3754 return string_literal<CharT, 4>(x[0], x[1], y[0]);
3757template <
class CharT1,
class CharT2, std::
size_t N1, std::
size_t N2>
3759 typename std::conditional<
sizeof(CharT2) <=
sizeof(CharT1), CharT1, CharT2>::type,
3761operator+(
const string_literal<CharT1, N1>& x,
3762 const string_literal<CharT2, N2>& y)
NOEXCEPT
3765 typename std::conditional<
sizeof(CharT2) <=
sizeof(CharT1), CharT1, CharT2>::type;
3767 string_literal<CT, N1 + N2 - 1>
r;
3769 for (;
i < N1 - 1; ++
i)
3770 r.p_[
i] = CT(x.p_[
i]);
3771 for (std::size_t
j = 0;
j < N2; ++
j, ++
i)
3772 r.p_[
i] = CT(y.p_[
j]);
3778template <
class CharT,
class Traits,
class Alloc, std::
size_t N>
3779inline std::basic_string<CharT, Traits, Alloc>
3780operator+(std::basic_string<CharT, Traits, Alloc> x,
const string_literal<CharT, N>& y)
3782 x.append(y.data(), y.size());
3786#if __cplusplus >= 201402 && (!defined(__EDG_VERSION__) || __EDG_VERSION__ > 411) && \
3787 (!defined(__SUNPRO_CC) || __SUNPRO_CC > 0x5150)
3791 class = std::enable_if_t<
3792 std::is_same<CharT, char>::value || std::is_same<CharT, wchar_t>::value ||
3793 std::is_same<CharT, char16_t>::value || std::is_same<CharT, char32_t>::value>>
3796 return string_literal<CharT, 2>{ c };
3800inline std::size_t to_string_len(std::intmax_t
i)
3810template <std::
intmax_t N>
3812 N<10, string_literal<char, to_string_len(N) + 1>> msl()
NOEXCEPT
3814 return msl(
char(N % 10 +
'0'));
3817template <std::
intmax_t N>
3818CONSTCD14 inline std::enable_if_t<10 <= N, string_literal<char, to_string_len(N) + 1>>
3821 return msl<N / 10>() + msl(
char(N % 10 +
'0'));
3824template <
class CharT, std::
intmax_t N, std::
intmax_t D>
3827 string_literal<CharT,
3828 to_string_len(std::ratio<N, D>::type::num) +
3832 using R =
typename std::ratio<N, D>::type;
3833 return msl(CharT{
'[' }) + msl<R::num>() + msl(CharT{
'/' }) + msl<R::den>() +
3837template <
class CharT, std::
intmax_t N, std::
intmax_t D>
3840 string_literal<CharT, to_string_len(std::ratio<N, D>::type::num) + 3>>
3843 using R =
typename std::ratio<N, D>::type;
3844 return msl(CharT{
'[' }) + msl<R::num>() + msl(CharT{
']' });
3850inline std::string to_string(std::uint64_t x) {
return std::to_string(x); }
3852template <
class CharT>
3853inline std::basic_string<CharT> to_string(std::uint64_t x)
3855 auto y = std::to_string(x);
3856 return std::basic_string<CharT>(y.begin(), y.end());
3859template <
class CharT, std::
intmax_t N, std::
intmax_t D>
3861 std::basic_string<CharT>>::type
3862msl(std::ratio<N, D>)
3864 using R =
typename std::ratio<N, D>::type;
3865 return std::basic_string<CharT>(1,
'[') + to_string<CharT>(R::num) + CharT{
'/' } +
3866 to_string<CharT>(
R::den) + CharT{
']' };
3869template <
class CharT, std::
intmax_t N, std::
intmax_t D>
3871 std::basic_string<CharT>>::type
3872msl(std::ratio<N, D>)
3874 using R =
typename std::ratio<N, D>::type;
3875 return std::basic_string<CharT>(1,
'[') + to_string<CharT>(R::num) + CharT{
']' };
3880template <
class CharT>
3883 return string_literal<CharT, 2>{
'a' };
3886template <
class CharT>
3889 return string_literal<CharT, 2>{
'f' };
3892template <
class CharT>
3895 return string_literal<CharT, 2>{
'p' };
3898template <
class CharT>
3901 return string_literal<CharT, 2>{
'n' };
3904template <
class CharT>
3905CONSTCD11 inline typename std::enable_if<std::is_same<CharT, char>::value,
3906 string_literal<char, 3>>::type
3909 return string_literal<char, 3>{
'\xC2',
'\xB5' };
3912template <
class CharT>
3913CONSTCD11 inline typename std::enable_if<!std::is_same<CharT, char>::value,
3914 string_literal<CharT, 2>>::type
3917 return string_literal<CharT, 2>{ CharT{
static_cast<unsigned char>(
'\xB5') } };
3920template <
class CharT>
3923 return string_literal<CharT, 2>{
'm' };
3926template <
class CharT>
3929 return string_literal<CharT, 2>{
'c' };
3932template <
class CharT>
3935 return string_literal<CharT, 3>{
'd',
'a' };
3938template <
class CharT>
3941 return string_literal<CharT, 2>{
'd' };
3944template <
class CharT>
3947 return string_literal<CharT, 2>{
'h' };
3950template <
class CharT>
3953 return string_literal<CharT, 2>{
'k' };
3956template <
class CharT>
3959 return string_literal<CharT, 2>{
'M' };
3962template <
class CharT>
3965 return string_literal<CharT, 2>{
'G' };
3968template <
class CharT>
3971 return string_literal<CharT, 2>{
'T' };
3974template <
class CharT>
3977 return string_literal<CharT, 2>{
'P' };
3980template <
class CharT>
3983 return string_literal<CharT, 2>{
'E' };
3986template <
class CharT,
class Period>
3987CONSTCD11 inline auto get_units(Period p)
3988 ->
decltype(msl<CharT>(p) + string_literal<CharT, 2>{
's' })
3990 return msl<CharT>(p) + string_literal<CharT, 2>{
's' };
3993template <
class CharT>
3994CONSTCD11 inline string_literal<CharT, 2> get_units(std::ratio<1>)
3996 return string_literal<CharT, 2>{
's' };
3999template <
class CharT>
4000CONSTCD11 inline string_literal<CharT, 2> get_units(std::ratio<3600>)
4002 return string_literal<CharT, 2>{
'h' };
4005template <
class CharT>
4006CONSTCD11 inline string_literal<CharT, 4> get_units(std::ratio<60>)
4008 return string_literal<CharT, 4>{
'm',
'i',
'n' };
4011template <
class CharT>
4012CONSTCD11 inline string_literal<CharT, 2> get_units(std::ratio<86400>)
4014 return string_literal<CharT, 2>{
'd' };
4017template <
class CharT,
class Traits = std::
char_traits<CharT>>
4021struct make_string<char> {
4022 template <
class Rep>
4023 static std::string from(Rep n)
4025 return std::to_string(n);
4029template <
class Traits>
4030struct make_string<char, Traits> {
4031 template <
class Rep>
4032 static std::basic_string<char, Traits> from(Rep n)
4034 auto s = std::to_string(n);
4035 return std::basic_string<char, Traits>(
s.begin(),
s.end());
4040struct make_string<wchar_t> {
4041 template <
class Rep>
4042 static std::wstring from(Rep n)
4044 return std::to_wstring(n);
4048template <
class Traits>
4049struct make_string<wchar_t, Traits> {
4050 template <
class Rep>
4051 static std::basic_string<wchar_t, Traits> from(Rep n)
4053 auto s = std::to_wstring(n);
4054 return std::basic_string<wchar_t, Traits>(
s.begin(),
s.end());
4064template <
class Duration>
4069 bool has_tod =
false;
4071#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ <= 409)
4072 fields() : ymd{
nanyear / 0 / 0 }, wd{ 8u }, tod{}, has_tod{ false } {}
4083 : ymd(ymd_), tod(tod_), has_tod(true)
4090 : ymd(ymd_), wd(wd_), tod(tod_), has_tod(true)
4097template <
class CharT,
class Traits,
class Duration>
4103 os.setstate(std::ios::failbit);
4109 if (fds.
wd.
ok() && wd != fds.
wd) {
4111 os.setstate(std::ios::failbit);
4116 return static_cast<unsigned>((wd -
Sunday).
count());
4119template <
class CharT,
class Traits,
class Duration>
4124 os.setstate(std::ios::failbit);
4127 return static_cast<unsigned>(fds.
ymd.
month());
4136inline std::pair<const std::string*, const std::string*> weekday_names()
4138 static const std::string nm[] = {
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
4139 "Thursday",
"Friday",
"Saturday",
"Sun",
4140 "Mon",
"Tue",
"Wed",
"Thu",
4142 return std::make_pair(nm, nm +
sizeof(nm) /
sizeof(nm[0]));
4145inline std::pair<const std::string*, const std::string*> month_names()
4147 static const std::string nm[] = {
4148 "January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
4149 "September",
"October",
"November",
"December",
"Jan",
"Feb",
"Mar",
"Apr",
4150 "May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
4152 return std::make_pair(nm, nm +
sizeof(nm) /
sizeof(nm[0]));
4155inline std::pair<const std::string*, const std::string*> ampm_names()
4157 static const std::string nm[] = {
"AM",
"PM" };
4158 return std::make_pair(nm, nm +
sizeof(nm) /
sizeof(nm[0]));
4161template <
class CharT,
class Traits,
class FwdIter>
4162FwdIter scan_keyword(std::basic_istream<CharT, Traits>& is, FwdIter kb, FwdIter ke)
4164 size_t nkw =
static_cast<size_t>(std::distance(kb, ke));
4165 const unsigned char doesnt_match =
'\0';
4166 const unsigned char might_match =
'\1';
4167 const unsigned char does_match =
'\2';
4168 unsigned char statbuf[100];
4169 unsigned char* status = statbuf;
4170 std::unique_ptr<
unsigned char, void (*)(
void*)> stat_hold(0, free);
4171 if (nkw >
sizeof(statbuf)) {
4172 status = (
unsigned char*)std::malloc(nkw);
4173 if (status ==
nullptr)
4174 throw std::bad_alloc();
4175 stat_hold.reset(status);
4177 size_t n_might_match = nkw;
4178 size_t n_does_match = 0;
4180 unsigned char* st = status;
4181 for (
auto ky = kb; ky != ke; ++ky, ++st) {
4191 for (
size_t indx = 0; is && n_might_match > 0; ++indx) {
4193 auto ic = is.peek();
4195 is.setstate(std::ios::eofbit);
4198 auto c =
static_cast<char>(toupper(
static_cast<unsigned char>(ic)));
4199 bool consume =
false;
4207 for (
auto ky = kb; ky != ke; ++ky, ++st) {
4208 if (*st == might_match) {
4210 static_cast<char>(toupper(
static_cast<unsigned char>((*ky)[indx])))) {
4212 if (ky->size() == indx + 1) {
4229 if (n_might_match + n_does_match > 1) {
4231 for (
auto ky = kb; ky != ke; ++ky, ++st) {
4232 if (*st == does_match && ky->size() != indx + 1) {
4242 for (st = status; kb != ke; ++kb, ++st)
4243 if (*st == does_match)
4246 is.setstate(std::ios::failbit);
4254template <
class CharT,
class Traits,
class Duration>
4255std::basic_ostream<CharT, Traits>&
to_stream(std::basic_ostream<CharT, Traits>& os,
4258 const std::string* abbrev,
4259 const std::chrono::seconds* offset_sec)
4262 using detail::ampm_names;
4263 using detail::month_names;
4264 using detail::weekday_names;
4268 using detail::get_units;
4271 using std::chrono::duration_cast;
4272 using std::chrono::hours;
4273 using std::chrono::minutes;
4274 using std::chrono::seconds;
4280 bool insert_negative = fds.
has_tod && fds.
tod.to_duration() < Duration::zero();
4282 auto& facet = std::use_facet<std::time_put<CharT>>(os.getloc());
4284 const CharT* command =
nullptr;
4285 CharT modified = CharT{};
4286 for (; *fmt; ++fmt) {
4291 if (modified == CharT{}) {
4296 const CharT f[] = {
'%', *fmt };
4297 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
4299 os << weekday_names().first[tm.tm_wday + 7 * (*fmt ==
'a')];
4302 os << CharT{
'%' } << modified << *fmt;
4313 if (modified == CharT{}) {
4316 const CharT f[] = {
'%', *fmt };
4317 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
4319 os << month_names().first[tm.tm_mon + 12 * (*fmt !=
'B')];
4322 os << CharT{
'%' } << modified << *fmt;
4332 if (modified == CharT{
'O' })
4333 os << CharT{
'%' } << modified << *fmt;
4336 os.setstate(std::ios::failbit);
4337 if (*fmt ==
'c' && !fds.
has_tod)
4338 os.setstate(std::ios::failbit);
4341 auto const& ymd = fds.
ymd;
4344 tm.tm_sec =
static_cast<int>(fds.
tod.seconds().count());
4345 tm.tm_min =
static_cast<int>(fds.
tod.minutes().count());
4346 tm.tm_hour =
static_cast<int>(fds.
tod.hours().count());
4348 tm.tm_mday =
static_cast<int>(
static_cast<unsigned>(ymd.day()));
4350 tm.tm_year =
static_cast<int>(ymd.year()) - 1900;
4356 CharT f[3] = {
'%' };
4357 auto fe = std::begin(f) + 1;
4358 if (modified == CharT{
'E' })
4361 facet.put(os, os, os.fill(), &tm, std::begin(f), fe);
4365 os << weekday_names().first[
static_cast<unsigned>(wd) + 7] <<
' ';
4366 os << month_names().first[
extract_month(os, fds) - 1 + 12] <<
' ';
4367 auto d =
static_cast<int>(
static_cast<unsigned>(fds.
ymd.
day()));
4371 <<
make_time(duration_cast<seconds>(fds.
tod.to_duration()))
4376 auto const& ymd = fds.
ymd;
4377 save_ostream<CharT, Traits> _(os);
4381 os << static_cast<unsigned>(ymd.month()) << CharT{
'/' };
4383 os << static_cast<unsigned>(ymd.day()) << CharT{
'/' };
4385 os << static_cast<int>(ymd.year()) % 100;
4396 if (modified == CharT{
'O' })
4397 os << CharT{
'%' } << modified << *fmt;
4400 os.setstate(std::ios::failbit);
4401 auto y =
static_cast<int>(fds.
ymd.
year());
4403 if (modified == CharT{})
4406 save_ostream<CharT, Traits> _(os);
4415 os << -(y - 99) / 100;
4419 else if (modified == CharT{
'E' }) {
4420 tm.tm_year = y - 1900;
4421 CharT f[3] = {
'%',
'E',
'C' };
4422 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
4434 if (modified == CharT{
'E' })
4435 os << CharT{
'%' } << modified << *fmt;
4438 os.setstate(std::ios::failbit);
4439 auto d =
static_cast<int>(
static_cast<unsigned>(fds.
ymd.
day()));
4441 if (modified == CharT{})
4444 save_ostream<CharT, Traits> _(os);
4445 if (*fmt == CharT{
'd' })
4454 else if (modified == CharT{
'O' }) {
4456 CharT f[3] = {
'%',
'O', *fmt };
4457 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
4468 if (modified == CharT{}) {
4470 os.setstate(std::ios::failbit);
4471 auto const& ymd = fds.
ymd;
4472 save_ostream<CharT, Traits> _(os);
4476 os << static_cast<unsigned>(ymd.month()) << CharT{
'/' };
4478 os << static_cast<unsigned>(ymd.day()) << CharT{
'/' };
4480 os << static_cast<int>(ymd.year()) % 100;
4482 os << CharT{
'%' } << modified << *fmt;
4491 if (modified == CharT{}) {
4493 os.setstate(std::ios::failbit);
4494 auto const& ymd = fds.
ymd;
4495 save_ostream<CharT, Traits> _(os);
4496 os.imbue(std::locale::classic());
4500 os << static_cast<int>(ymd.year()) << CharT{
'-' };
4502 os << static_cast<unsigned>(ymd.month()) << CharT{
'-' };
4504 os << static_cast<unsigned>(ymd.day());
4506 os << CharT{
'%' } << modified << *fmt;
4516 if (modified == CharT{}) {
4518 os.setstate(std::ios::failbit);
4526 if (*fmt == CharT{
'G' })
4529 save_ostream<CharT, Traits> _(os);
4533 os << std::abs(static_cast<int>(y)) % 100;
4536 os << CharT{
'%' } << modified << *fmt;
4546 if (modified == CharT{
'E' })
4547 os << CharT{
'%' } << modified << *fmt;
4550 os.setstate(std::ios::failbit);
4551 if (insert_negative) {
4553 insert_negative =
false;
4557 if (modified == CharT{})
4560 auto h = *fmt == CharT{
'I' } ?
date::make12(hms.hours())
4562 if (h < hours{ 10 })
4567 else if (modified == CharT{
'O' }) {
4568 const CharT f[] = {
'%', modified, *fmt };
4569 tm.tm_hour =
static_cast<int>(hms.hours().count());
4570 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
4581 if (modified == CharT{}) {
4589 doy = duration_cast<days>(fds.
tod.to_duration());
4591 save_ostream<CharT, Traits> _(os);
4597 os.setstate(std::ios::failbit);
4600 os << CharT{
'%' } << modified << *fmt;
4609 if (modified == CharT{
'E' })
4610 os << CharT{
'%' } << modified << *fmt;
4613 os.setstate(std::ios::failbit);
4614 auto m =
static_cast<unsigned>(fds.
ymd.
month());
4616 if (modified == CharT{})
4624 else if (modified == CharT{
'O' }) {
4625 const CharT f[] = {
'%', modified, *fmt };
4626 tm.tm_mon =
static_cast<int>(m - 1);
4627 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
4638 if (modified == CharT{
'E' })
4639 os << CharT{
'%' } << modified << *fmt;
4642 os.setstate(std::ios::failbit);
4643 if (insert_negative) {
4645 insert_negative =
false;
4648 if (modified == CharT{})
4651 if (fds.
tod.minutes() < minutes{ 10 })
4653 os << fds.
tod.minutes().count();
4656 else if (modified == CharT{
'O' }) {
4657 const CharT f[] = {
'%', modified, *fmt };
4658 tm.tm_min =
static_cast<int>(fds.
tod.minutes().count());
4659 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
4670 if (modified == CharT{})
4671 os << CharT{
'\n' };
4673 os << CharT{
'%' } << modified << *fmt;
4682 if (modified == CharT{}) {
4684 os.setstate(std::ios::failbit);
4686 const CharT f[] = {
'%', *fmt };
4687 tm.tm_hour =
static_cast<int>(fds.
tod.hours().count());
4688 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
4691 os << ampm_names().first[0];
4693 os << ampm_names().first[1];
4696 os << CharT{
'%' } << modified << *fmt;
4706 if (modified == CharT{}) {
4708 os.setstate(std::ios::failbit);
4709 auto d = fds.
tod.to_duration();
4711 os << get_units<CharT>(
typename decltype(d)::period::type{});
4715 os << CharT{
'%' } << modified << *fmt;
4724 if (modified == CharT{}) {
4726 os.setstate(std::ios::failbit);
4728 const CharT f[] = {
'%', *fmt };
4729 tm.tm_hour =
static_cast<int>(fds.
tod.hours().count());
4730 tm.tm_min =
static_cast<int>(fds.
tod.minutes().count());
4731 tm.tm_sec =
static_cast<int>(fds.
tod.seconds().count());
4732 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
4735 save_ostream<CharT, Traits> _(os);
4740 os << tod.
minutes().count() << CharT{
':' };
4742 os << tod.
seconds().count() << CharT{
' ' };
4744 os << ampm_names().first[0];
4746 os << ampm_names().first[1];
4749 os << CharT{
'%' } << modified << *fmt;
4758 if (modified == CharT{}) {
4760 os.setstate(std::ios::failbit);
4761 if (fds.
tod.hours() < hours{ 10 })
4763 os << fds.
tod.hours().count() << CharT{
':' };
4764 if (fds.
tod.minutes() < minutes{ 10 })
4766 os << fds.
tod.minutes().count();
4768 os << CharT{
'%' } << modified << *fmt;
4777 if (modified == CharT{
'E' })
4778 os << CharT{
'%' } << modified << *fmt;
4781 os.setstate(std::ios::failbit);
4782 if (insert_negative) {
4784 insert_negative =
false;
4787 if (modified == CharT{})
4793 else if (modified == CharT{
'O' }) {
4794 const CharT f[] = {
'%', modified, *fmt };
4795 tm.tm_sec =
static_cast<int>(fds.
tod.s_.seconds().count());
4796 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
4807 if (modified == CharT{})
4808 os << CharT{
'\t' };
4810 os << CharT{
'%' } << modified << *fmt;
4819 if (modified == CharT{}) {
4821 os.setstate(std::ios::failbit);
4824 os << CharT{
'%' } << modified << *fmt;
4833 if (modified == CharT{
'E' })
4834 os << CharT{
'%' } << modified << *fmt;
4838 if (modified == CharT{})
4841 os << (wd != 0 ? wd : 7u);
4844 else if (modified == CharT{
'O' }) {
4845 const CharT f[] = {
'%', modified, *fmt };
4846 tm.tm_wday =
static_cast<int>(wd);
4847 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
4858 if (modified == CharT{
'E' })
4859 os << CharT{
'%' } << modified << *fmt;
4861 auto const& ymd = fds.
ymd;
4863 os.setstate(std::ios::failbit);
4866 if (modified == CharT{})
4871 os << CharT{
'0' } << CharT{
'0' };
4873 auto wn = duration_cast<weeks>(ld - st).count() + 1;
4880 else if (modified == CharT{
'O' }) {
4881 const CharT f[] = {
'%', modified, *fmt };
4882 tm.tm_year =
static_cast<int>(ymd.year()) - 1900;
4886 tm.tm_yday =
static_cast<int>(
4888 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
4899 if (modified == CharT{
'E' })
4900 os << CharT{
'%' } << modified << *fmt;
4903 os.setstate(std::ios::failbit);
4906 if (modified == CharT{})
4917 auto wn = duration_cast<weeks>(ld - st).count() + 1;
4923 else if (modified == CharT{
'O' }) {
4924 const CharT f[] = {
'%', modified, *fmt };
4925 auto const& ymd = fds.
ymd;
4926 tm.tm_year =
static_cast<int>(ymd.year()) - 1900;
4930 tm.tm_yday =
static_cast<int>(
4932 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
4947 if (modified == CharT{})
4949 if (modified != CharT{
'E' })
4955 else if (modified == CharT{
'O' }) {
4956 const CharT f[] = {
'%', modified, *fmt };
4957 tm.tm_wday =
static_cast<int>(wd);
4958 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
4962 os << CharT{
'%' } << modified << *fmt;
4971 if (modified == CharT{
'E' })
4972 os << CharT{
'%' } << modified << *fmt;
4974 auto const& ymd = fds.
ymd;
4976 os.setstate(std::ios::failbit);
4979 if (modified == CharT{})
4984 os << CharT{
'0' } << CharT{
'0' };
4986 auto wn = duration_cast<weeks>(ld - st).count() + 1;
4993 else if (modified == CharT{
'O' }) {
4994 const CharT f[] = {
'%', modified, *fmt };
4995 tm.tm_year =
static_cast<int>(ymd.year()) - 1900;
4999 tm.tm_yday =
static_cast<int>(
5001 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
5012 if (modified == CharT{
'O' })
5013 os << CharT{
'%' } << modified << *fmt;
5016 os.setstate(std::ios::failbit);
5019 tm.tm_sec =
static_cast<int>(fds.
tod.seconds().count());
5020 tm.tm_min =
static_cast<int>(fds.
tod.minutes().count());
5021 tm.tm_hour =
static_cast<int>(fds.
tod.hours().count());
5022 CharT f[3] = {
'%' };
5023 auto fe = std::begin(f) + 1;
5024 if (modified == CharT{
'E' })
5027 facet.put(os, os, os.fill(), &tm, std::begin(f), fe);
5040 os.setstate(std::ios::failbit);
5041 auto y =
static_cast<int>(fds.
ymd.
year());
5043 if (modified == CharT{}) {
5051 const CharT f[] = {
'%', modified, *fmt };
5052 tm.tm_year = y - 1900;
5053 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
5063 if (modified == CharT{
'O' })
5064 os << CharT{
'%' } << modified << *fmt;
5067 os.setstate(std::ios::failbit);
5070 if (modified == CharT{})
5073 save_ostream<CharT, Traits> _(os);
5074 os.imbue(std::locale::classic());
5078 else if (modified == CharT{
'E' }) {
5079 const CharT f[] = {
'%', modified, *fmt };
5080 tm.tm_year =
static_cast<int>(y) - 1900;
5081 facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f));
5092 if (offset_sec ==
nullptr) {
5094 os.setstate(ios::failbit);
5097 auto m = duration_cast<minutes>(*offset_sec);
5098 auto neg = m < minutes{ 0 };
5100 auto h = duration_cast<hours>(m);
5106 if (h < hours{ 10 })
5109 if (modified != CharT{})
5111 if (m < minutes{ 10 })
5121 if (modified == CharT{}) {
5122 if (abbrev ==
nullptr) {
5124 os.setstate(ios::failbit);
5127 for (
auto c : *abbrev)
5130 os << CharT{
'%' } << modified << *fmt;
5140 if (modified == CharT{}) {
5143 os << CharT{
'%' } << modified << *fmt;
5152 if (modified == CharT{}) {
5156 os << CharT{
'%' } << modified << CharT{
'%' };
5168 if (modified != CharT{}) {
5178 if (modified != CharT{})
5183template <
class CharT,
class Traits>
5184inline std::basic_ostream<CharT, Traits>&
5185to_stream(std::basic_ostream<CharT, Traits>& os,
const CharT* fmt,
const year& y)
5187 using CT = std::chrono::seconds;
5192template <
class CharT,
class Traits>
5193inline std::basic_ostream<CharT, Traits>&
5196 using CT = std::chrono::seconds;
5201template <
class CharT,
class Traits>
5202inline std::basic_ostream<CharT, Traits>&
5203to_stream(std::basic_ostream<CharT, Traits>& os,
const CharT* fmt,
const day& d)
5205 using CT = std::chrono::seconds;
5210template <
class CharT,
class Traits>
5211inline std::basic_ostream<CharT, Traits>&
5214 using CT = std::chrono::seconds;
5219template <
class CharT,
class Traits>
5220inline std::basic_ostream<CharT, Traits>&
5223 using CT = std::chrono::seconds;
5228template <
class CharT,
class Traits>
5229inline std::basic_ostream<CharT, Traits>&
5232 using CT = std::chrono::seconds;
5237template <
class CharT,
class Traits>
5238inline std::basic_ostream<CharT, Traits>&
to_stream(std::basic_ostream<CharT, Traits>& os,
5242 using CT = std::chrono::seconds;
5247template <
class CharT,
class Traits,
class Rep,
class Period>
5248inline std::basic_ostream<CharT, Traits>&
5251 const std::chrono::duration<Rep, Period>& d)
5253 using Duration = std::chrono::duration<Rep, Period>;
5254 using CT =
typename std::common_type<Duration, std::chrono::seconds>::type;
5259template <
class CharT,
class Traits,
class Duration>
5260std::basic_ostream<CharT, Traits>&
5264 const std::string* abbrev =
nullptr,
5265 const std::chrono::seconds* offset_sec =
nullptr)
5267 using CT =
typename std::common_type<Duration, std::chrono::seconds>::type;
5268 auto ld = std::chrono::time_point_cast<days>(tp);
5276 return to_stream(os, fmt, fds, abbrev, offset_sec);
5279template <
class CharT,
class Traits,
class Duration>
5280std::basic_ostream<CharT, Traits>&
to_stream(std::basic_ostream<CharT, Traits>& os,
5284 using std::chrono::seconds;
5285 using CT =
typename std::common_type<Duration, seconds>::type;
5286 const std::string abbrev(
"UTC");
5288 auto sd = std::chrono::time_point_cast<days>(tp);
5295 return to_stream(os, fmt, fds, &abbrev, &offset);
5300template <
class CharT,
class Streamable>
5301auto format(
const std::locale&
loc,
const CharT* fmt,
const Streamable& tp)
5302 ->
decltype(
to_stream(std::declval<std::basic_ostream<CharT>&>(), fmt, tp),
5303 std::basic_string<CharT>{})
5305 std::basic_ostringstream<CharT> os;
5306 os.exceptions(std::ios::failbit | std::ios::badbit);
5312template <
class CharT,
class Streamable>
5313auto format(
const CharT* fmt,
const Streamable& tp)
5314 ->
decltype(
to_stream(std::declval<std::basic_ostream<CharT>&>(), fmt, tp),
5315 std::basic_string<CharT>{})
5317 std::basic_ostringstream<CharT> os;
5318 os.exceptions(std::ios::failbit | std::ios::badbit);
5323template <
class CharT,
class Traits,
class Alloc,
class Streamable>
5325 const std::basic_string<CharT, Traits, Alloc>& fmt,
5326 const Streamable& tp)
5327 ->
decltype(
to_stream(std::declval<std::basic_ostream<CharT, Traits>&>(),
5330 std::basic_string<CharT, Traits, Alloc>{})
5332 std::basic_ostringstream<CharT, Traits, Alloc> os;
5333 os.exceptions(std::ios::failbit | std::ios::badbit);
5339template <
class CharT,
class Traits,
class Alloc,
class Streamable>
5340auto format(
const std::basic_string<CharT, Traits, Alloc>& fmt,
const Streamable& tp)
5341 ->
decltype(
to_stream(std::declval<std::basic_ostream<CharT, Traits>&>(),
5344 std::basic_string<CharT, Traits, Alloc>{})
5346 std::basic_ostringstream<CharT, Traits, Alloc> os;
5347 os.exceptions(std::ios::failbit | std::ios::badbit);
5356template <
class CharT,
class Traits>
5357bool read_char(std::basic_istream<CharT, Traits>& is, CharT fmt, std::ios::iostate& err)
5360 if (Traits::eq_int_type(ic, Traits::eof()) ||
5361 !Traits::eq(Traits::to_char_type(ic), fmt)) {
5362 err |= std::ios::failbit;
5363 is.setstate(std::ios::failbit);
5369template <
class CharT,
class Traits>
5371read_unsigned(std::basic_istream<CharT, Traits>& is,
unsigned m = 1,
unsigned M = 10)
5376 auto ic = is.peek();
5377 if (Traits::eq_int_type(ic, Traits::eof()))
5379 auto c =
static_cast<char>(Traits::to_char_type(ic));
5380 if (!(
'0' <= c && c <=
'9'))
5384 x = 10 * x +
static_cast<unsigned>(c -
'0');
5389 is.setstate(std::ios::failbit);
5393template <
class CharT,
class Traits>
5394int read_signed(std::basic_istream<CharT, Traits>& is,
unsigned m = 1,
unsigned M = 10)
5396 auto ic = is.peek();
5397 if (!Traits::eq_int_type(ic, Traits::eof())) {
5398 auto c =
static_cast<char>(Traits::to_char_type(ic));
5399 if ((
'0' <= c && c <=
'9') || c ==
'-' || c ==
'+') {
5400 if (c ==
'-' || c ==
'+')
5402 auto x =
static_cast<int>(
read_unsigned(is, std::max(m, 1u), M));
5411 is.setstate(std::ios::failbit);
5415template <
class CharT,
class Traits>
5420 unsigned fcount = 0;
5421 unsigned long long i = 0;
5422 unsigned long long f = 0;
5423 bool parsing_fraction =
false;
5425 typename Traits::int_type decimal_point =
'.';
5427 auto decimal_point = Traits::to_int_type(
5428 std::use_facet<std::numpunct<CharT>>(is.getloc()).decimal_point());
5431 auto ic = is.peek();
5432 if (Traits::eq_int_type(ic, Traits::eof()))
5434 if (Traits::eq_int_type(ic, decimal_point)) {
5435 decimal_point = Traits::eof();
5436 parsing_fraction =
true;
5438 auto c =
static_cast<char>(Traits::to_char_type(ic));
5439 if (!(
'0' <= c && c <=
'9'))
5441 if (!parsing_fraction) {
5442 i = 10 *
i +
static_cast<unsigned>(c -
'0');
5444 f = 10 * f +
static_cast<unsigned>(c -
'0');
5453 is.setstate(std::ios::failbit);
5456 return static_cast<long double>(
i) +
5457 static_cast<long double>(f) / std::pow(10.L, fcount);
5478template <
class CharT,
class Traits>
5479void read(std::basic_istream<CharT, Traits>&)
5483template <
class CharT,
class Traits,
class... Args>
5484void read(std::basic_istream<CharT, Traits>& is, CharT a0, Args&&... args);
5486template <
class CharT,
class Traits,
class... Args>
5487void read(std::basic_istream<CharT, Traits>& is,
rs a0, Args&&... args);
5489template <
class CharT,
class Traits,
class... Args>
5490void read(std::basic_istream<CharT, Traits>& is, ru a0, Args&&... args);
5492template <
class CharT,
class Traits,
class... Args>
5493void read(std::basic_istream<CharT, Traits>& is,
int a0, Args&&... args);
5495template <
class CharT,
class Traits,
class... Args>
5496void read(std::basic_istream<CharT, Traits>& is, rld a0, Args&&... args);
5498template <
class CharT,
class Traits,
class... Args>
5499void read(std::basic_istream<CharT, Traits>& is, CharT a0, Args&&... args)
5502 if (a0 != CharT{}) {
5503 auto ic = is.peek();
5504 if (Traits::eq_int_type(ic, Traits::eof())) {
5505 is.setstate(std::ios::failbit | std::ios::eofbit);
5508 if (!Traits::eq(Traits::to_char_type(ic), a0)) {
5509 is.setstate(std::ios::failbit);
5514 read(is, std::forward<Args>(args)...);
5517template <
class CharT,
class Traits,
class... Args>
5518void read(std::basic_istream<CharT, Traits>& is,
rs a0, Args&&... args)
5524 read(is, std::forward<Args>(args)...);
5527template <
class CharT,
class Traits,
class... Args>
5528void read(std::basic_istream<CharT, Traits>& is,
ru a0, Args&&... args)
5533 a0.
i =
static_cast<int>(x);
5534 read(is, std::forward<Args>(args)...);
5537template <
class CharT,
class Traits,
class... Args>
5538void read(std::basic_istream<CharT, Traits>& is,
int a0, Args&&... args)
5541 auto u =
static_cast<unsigned>(a0);
5542 CharT buf[std::numeric_limits<unsigned>::digits10 + 2u] = {};
5545 *e++ =
static_cast<CharT
>(CharT(
u % 10) + CharT{
'0' });
5548 std::reverse(buf, e);
5549 for (
auto p = buf; p != e && is.rdstate() == std::ios::goodbit; ++p)
5552 if (is.rdstate() == std::ios::goodbit)
5553 read(is, std::forward<Args>(args)...);
5556template <
class CharT,
class Traits,
class... Args>
5557void read(std::basic_istream<CharT, Traits>& is,
rld a0, Args&&... args)
5563 read(is, std::forward<Args>(args)...);
5566template <
class T,
class CharT,
class Traits>
5568checked_set(T& value, T from, T not_a_value, std::basic_ios<CharT, Traits>& is)
5571 if (value == not_a_value)
5572 value = std::move(from);
5573 else if (value != from)
5574 is.setstate(std::ios::failbit);
5580template <
class CharT,
class Traits,
class Duration,
class Alloc = std::allocator<CharT>>
5581std::basic_istream<CharT, Traits>&
5585 std::basic_string<CharT, Traits, Alloc>* abbrev,
5586 std::chrono::minutes* offset)
5590 using std::numeric_limits;
5591 using std::chrono::duration;
5592 using std::chrono::duration_cast;
5593 using std::chrono::hours;
5594 using std::chrono::minutes;
5595 using std::chrono::seconds;
5596 typename std::basic_istream<CharT, Traits>::sentry
ok{ is,
true };
5603 auto& f = std::use_facet<std::time_get<CharT>>(is.getloc());
5606 const CharT* command =
nullptr;
5607 auto modified = CharT{};
5610 CONSTDATA int not_a_year = numeric_limits<short>::min();
5612 CONSTDATA int not_a_century = not_a_year / 100;
5615 CONSTDATA int not_a_hour = numeric_limits<int>::min();
5617 CONSTDATA int not_a_minute = not_a_hour;
5618 CONSTDATA Duration not_a_second = Duration::min();
5623 CONSTDATA minutes not_a_offset = minutes::min();
5626 int y = not_a_2digit_year;
5627 int g = not_a_2digit_year;
5629 int C = not_a_century;
5630 int m = not_a_month;
5633 int wd = not_a_weekday;
5635 int I = not_a_hour_12_value;
5637 int M = not_a_minute;
5638 Duration
s = not_a_second;
5639 int U = not_a_week_num;
5640 int V = not_a_week_num;
5641 int W = not_a_week_num;
5642 std::basic_string<CharT, Traits, Alloc> temp_abbrev;
5643 minutes temp_offset = not_a_offset;
5650 for (; *fmt != CharT{} && !is.fail(); ++fmt) {
5657 int trial_wd = not_a_weekday;
5658 if (*fmt ==
'a' || *fmt ==
'A') {
5659 if (modified == CharT{}) {
5661 ios::iostate err = ios::goodbit;
5662 f.get(is,
nullptr, is, err, &tm, command, fmt + 1);
5665 trial_wd = tm.tm_wday;
5667 auto nm = detail::weekday_names();
5669 detail::scan_keyword(is, nm.first, nm.second) - nm.first;
5674 read(is, CharT{
'%' }, width, modified, *fmt);
5678 if (modified == CharT{})
5680 if (modified != CharT{
'E' })
5686 width == -1 ? 1u :
static_cast<unsigned>(width) });
5689 if (!(1 <= trial_wd && trial_wd <= 7)) {
5690 trial_wd = not_a_weekday;
5691 is.setstate(ios::failbit);
5692 }
else if (trial_wd == 7)
5696 if (!(0 <= trial_wd && trial_wd <= 6)) {
5697 trial_wd = not_a_weekday;
5698 is.setstate(ios::failbit);
5704 else if (modified == CharT{
'O' }) {
5705 ios::iostate err = ios::goodbit;
5706 f.get(is,
nullptr, is, err, &tm, command, fmt + 1);
5709 trial_wd = tm.tm_wday;
5713 read(is, CharT{
'%' }, width, modified, *fmt);
5715 if (trial_wd != not_a_weekday)
5727 if (modified == CharT{}) {
5728 int ttm = not_a_month;
5730 ios::iostate err = ios::goodbit;
5731 f.get(is,
nullptr, is, err, &tm, command, fmt + 1);
5732 if ((err & ios::failbit) == 0)
5733 ttm = tm.tm_mon + 1;
5736 auto nm = detail::month_names();
5737 auto i = detail::scan_keyword(is, nm.first, nm.second) - nm.first;
5743 read(is, CharT{
'%' }, width, modified, *fmt);
5752 if (modified != CharT{
'O' }) {
5754 ios::iostate err = ios::goodbit;
5755 f.get(is,
nullptr, is, err, &tm, command, fmt + 1);
5756 if ((err & ios::failbit) == 0) {
5757 checked_set(Y, tm.tm_year + 1900, not_a_year, is);
5763 duration_cast<Duration>(seconds{ tm.tm_sec }),
5770 auto nm = detail::weekday_names();
5771 auto i = detail::scan_keyword(is, nm.first, nm.second) - nm.first;
5772 checked_set(wd,
static_cast<int>(
i % 7), not_a_weekday, is);
5774 nm = detail::month_names();
5775 i = detail::scan_keyword(is, nm.first, nm.second) - nm.first;
5776 checked_set(m,
static_cast<int>(
i % 12 + 1), not_a_month, is);
5779 read(is,
rs{ td, 1, 2 });
5797 round_i<Duration>(duration<long double>{ S }),
5801 int tY = not_a_year;
5802 read(is,
rs{ tY, 1, 4u });
5806 read(is, CharT{
'%' }, width, modified, *fmt);
5815 if (modified != CharT{
'O' }) {
5817 ios::iostate err = ios::goodbit;
5818 f.get(is,
nullptr, is, err, &tm, command, fmt + 1);
5819 if ((err & ios::failbit) == 0) {
5820 checked_set(Y, tm.tm_year + 1900, not_a_year, is);
5827 int ty = not_a_2digit_year;
5828 int tm = not_a_month;
5841 read(is, CharT{
'%' }, width, modified, *fmt);
5850 if (modified != CharT{
'O' }) {
5852 ios::iostate err = ios::goodbit;
5853 f.get(is,
nullptr, is, err, &tm, command, fmt + 1);
5854 if ((err & ios::failbit) == 0) {
5858 duration_cast<Duration>(seconds{ tm.tm_sec }),
5868 int tH = not_a_hour;
5869 int tM = not_a_minute;
5880 round_i<Duration>(duration<long double>{ S }),
5885 read(is, CharT{
'%' }, width, modified, *fmt);
5894 int tC = not_a_century;
5896 if (modified == CharT{}) {
5900 rs{ tC, 1, width == -1 ? 2u :
static_cast<unsigned>(width) });
5903 ios::iostate err = ios::goodbit;
5904 f.get(is,
nullptr, is, err, &tm, command, fmt + 1);
5905 if ((err & ios::failbit) == 0) {
5906 auto tY = tm.tm_year + 1900;
5907 tC = (tY >= 0 ? tY : tY - 99) / 100;
5921 if (modified == CharT{}) {
5922 int tn = not_a_month;
5924 int ty = not_a_2digit_year;
5939 read(is, CharT{
'%' }, width, modified, *fmt);
5948 if (modified == CharT{}) {
5949 int tY = not_a_year;
5950 int tn = not_a_month;
5953 rs{ tY, 1, width == -1 ? 4u :
static_cast<unsigned>(width) },
5962 read(is, CharT{
'%' }, width, modified, *fmt);
5973 if (modified == CharT{})
5975 if (modified != CharT{
'E' })
5981 rs{ td, 1, width == -1 ? 2u :
static_cast<unsigned>(width) });
5985 else if (modified == CharT{
'O' }) {
5986 ios::iostate err = ios::goodbit;
5987 f.get(is,
nullptr, is, err, &tm, command, fmt + 1);
5991 if ((err & ios::failbit) == 0)
5997 read(is, CharT{
'%' }, width, modified, *fmt);
6007 if (modified == CharT{})
6009 if (modified != CharT{
'E' })
6012 int tH = not_a_hour;
6015 ru{ tH, 1, width == -1 ? 2u :
static_cast<unsigned>(width) });
6019 else if (modified == CharT{
'O' }) {
6020 ios::iostate err = ios::goodbit;
6021 f.get(is,
nullptr, is, err, &tm, command, fmt + 1);
6022 if ((err & ios::failbit) == 0)
6028 read(is, CharT{
'%' }, width, modified, *fmt);
6037 if (modified == CharT{}) {
6038 int tI = not_a_hour_12_value;
6042 rs{ tI, 1, width == -1 ? 2u :
static_cast<unsigned>(width) });
6043 if (!(1 <= tI && tI <= 12))
6044 is.setstate(ios::failbit);
6047 read(is, CharT{
'%' }, width, modified, *fmt);
6056 if (modified == CharT{}) {
6060 ru{ tj, 1, width == -1 ? 3u :
static_cast<unsigned>(width) });
6063 read(is, CharT{
'%' }, width, modified, *fmt);
6073 if (modified == CharT{})
6075 if (modified != CharT{
'E' })
6078 int tM = not_a_minute;
6081 ru{ tM, 1, width == -1 ? 2u :
static_cast<unsigned>(width) });
6085 else if (modified == CharT{
'O' }) {
6086 ios::iostate err = ios::goodbit;
6087 f.get(is,
nullptr, is, err, &tm, command, fmt + 1);
6088 if ((err & ios::failbit) == 0)
6094 read(is, CharT{
'%' }, width, modified, *fmt);
6104 if (modified == CharT{})
6106 if (modified != CharT{
'E' })
6109 int tn = not_a_month;
6112 rs{ tn, 1, width == -1 ? 2u :
static_cast<unsigned>(width) });
6116 else if (modified == CharT{
'O' }) {
6117 ios::iostate err = ios::goodbit;
6118 f.get(is,
nullptr, is, err, &tm, command, fmt + 1);
6119 if ((err & ios::failbit) == 0)
6125 read(is, CharT{
'%' }, width, modified, *fmt);
6135 if (modified == CharT{}) {
6138 auto ic = is.peek();
6139 if (Traits::eq_int_type(ic, Traits::eof())) {
6140 ios::iostate err = ios::eofbit;
6142 err |= ios::failbit;
6148 }
else if (*fmt ==
'n')
6149 is.setstate(ios::failbit);
6151 read(is, CharT{
'%' }, width, modified, *fmt);
6160 if (modified == CharT{}) {
6161 int tp = not_a_ampm;
6165 ios::iostate err = ios::goodbit;
6166 f.get(is,
nullptr, is, err, &tm, command, fmt + 1);
6168 if (tm.tm_hour == 1)
6170 else if (tm.tm_hour == 13)
6175 auto nm = detail::ampm_names();
6176 auto i = detail::scan_keyword(is, nm.first, nm.second) - nm.first;
6177 tp =
static_cast<decltype(tp)
>(
i);
6181 read(is, CharT{
'%' }, width, modified, *fmt);
6191 if (modified == CharT{}) {
6193 ios::iostate err = ios::goodbit;
6194 f.get(is,
nullptr, is, err, &tm, command, fmt + 1);
6195 if ((err & ios::failbit) == 0) {
6199 duration_cast<Duration>(seconds{ tm.tm_sec }),
6210 int tI = not_a_hour_12_value;
6211 int tM = not_a_minute;
6221 round_i<Duration>(duration<long double>{ S }),
6225 auto nm = detail::ampm_names();
6226 auto i = detail::scan_keyword(is, nm.first, nm.second) - nm.first;
6230 read(is, CharT{
'%' }, width, modified, *fmt);
6239 if (modified == CharT{}) {
6240 int tH = not_a_hour;
6241 int tM = not_a_minute;
6252 read(is, CharT{
'%' }, width, modified, *fmt);
6262 if (modified == CharT{})
6264 if (modified != CharT{
'E' })
6272 rld{ S, 1, width == -1 ? w :
static_cast<unsigned>(width) });
6274 round_i<Duration>(duration<long double>{ S }),
6279 else if (modified == CharT{
'O' }) {
6280 ios::iostate err = ios::goodbit;
6281 f.get(is,
nullptr, is, err, &tm, command, fmt + 1);
6282 if ((err & ios::failbit) == 0)
6284 duration_cast<Duration>(seconds{ tm.tm_sec }),
6291 read(is, CharT{
'%' }, width, modified, *fmt);
6300 if (modified == CharT{}) {
6304 int tH = not_a_hour;
6305 int tM = not_a_minute;
6316 round_i<Duration>(duration<long double>{ S }),
6320 read(is, CharT{
'%' }, width, modified, *fmt);
6330 if (modified == CharT{})
6332 if (modified != CharT{
'O' })
6335 int tY = not_a_year;
6338 rs{ tY, 1, width == -1 ? 4u :
static_cast<unsigned>(width) });
6342 else if (modified == CharT{
'E' }) {
6343 ios::iostate err = ios::goodbit;
6344 f.get(is,
nullptr, is, err, &tm, command, fmt + 1);
6345 if ((err & ios::failbit) == 0)
6346 checked_set(Y, tm.tm_year + 1900, not_a_year, is);
6351 read(is, CharT{
'%' }, width, modified, *fmt);
6361 if (modified == CharT{})
6364 int ty = not_a_2digit_year;
6367 ru{ ty, 1, width == -1 ? 2u :
static_cast<unsigned>(width) });
6372 ios::iostate err = ios::goodbit;
6373 f.get(is,
nullptr, is, err, &tm, command, fmt + 1);
6374 if ((err & ios::failbit) == 0)
6375 checked_set(Y, tm.tm_year + 1900, not_a_year, is);
6387 if (modified == CharT{}) {
6388 int tg = not_a_2digit_year;
6391 ru{ tg, 1, width == -1 ? 2u :
static_cast<unsigned>(width) });
6394 read(is, CharT{
'%' }, width, modified, *fmt);
6403 if (modified == CharT{}) {
6404 int tG = not_a_year;
6407 rs{ tG, 1, width == -1 ? 4u :
static_cast<unsigned>(width) });
6410 read(is, CharT{
'%' }, width, modified, *fmt);
6419 if (modified == CharT{}) {
6420 int tU = not_a_week_num;
6423 ru{ tU, 1, width == -1 ? 2u :
static_cast<unsigned>(width) });
6426 read(is, CharT{
'%' }, width, modified, *fmt);
6435 if (modified == CharT{}) {
6436 int tV = not_a_week_num;
6439 ru{ tV, 1, width == -1 ? 2u :
static_cast<unsigned>(width) });
6442 read(is, CharT{
'%' }, width, modified, *fmt);
6451 if (modified == CharT{}) {
6452 int tW = not_a_week_num;
6455 ru{ tW, 1, width == -1 ? 2u :
static_cast<unsigned>(width) });
6458 read(is, CharT{
'%' }, width, modified, *fmt);
6468 if (modified == CharT{}) {
6471 read(is, CharT{
'%' }, width, modified, *fmt);
6481 if (modified == CharT{})
6484 read(is, CharT{
'%' }, width, modified, *fmt);
6494 minutes toff = not_a_offset;
6496 auto ic = is.peek();
6497 if (!Traits::eq_int_type(ic, Traits::eof())) {
6498 auto c =
static_cast<char>(Traits::to_char_type(ic));
6502 if (modified == CharT{}) {
6503 read(is,
rs{ tH, 2, 2 });
6508 if (!Traits::eq_int_type(ic, Traits::eof())) {
6509 auto c =
static_cast<char>(Traits::to_char_type(ic));
6510 if (
'0' <= c && c <=
'9') {
6511 read(is, ru{ tM, 2, 2 });
6513 toff += minutes{ tM };
6518 read(is,
rs{ tH, 1, 2 });
6523 if (!Traits::eq_int_type(ic, Traits::eof())) {
6524 auto c =
static_cast<char>(Traits::to_char_type(ic));
6527 read(is, ru{ tM, 2, 2 });
6529 toff += minutes{ tM };
6545 if (modified == CharT{}) {
6546 std::basic_string<CharT, Traits, Alloc> buf;
6547 while (is.rdstate() == std::ios::goodbit) {
6548 auto i = is.rdbuf()->sgetc();
6549 if (Traits::eq_int_type(
i, Traits::eof())) {
6550 is.setstate(ios::eofbit);
6553 auto wc = Traits::to_char_type(
i);
6554 auto c =
static_cast<char>(wc);
6556 if (!(CharT{ 1 } < wc && wc < CharT{ 127 }) ||
6557 !(isalnum(c) || c ==
'_' || c ==
'/' || c ==
'-' ||
6561 is.rdbuf()->sbumpc();
6564 is.setstate(ios::failbit);
6567 read(is, CharT{
'%' }, width, modified, *fmt);
6576 if (width == -1 && modified == CharT{} &&
'0' <= *fmt &&
6578 width =
static_cast<char>(*fmt) -
'0';
6579 while (
'0' <= fmt[1] && fmt[1] <=
'9')
6580 width = 10 * width +
static_cast<char>(*++fmt) -
'0';
6582 if (modified == CharT{})
6583 read(is, CharT{
'%' }, width, *fmt);
6585 read(is, CharT{
'%' }, width, modified, *fmt);
6592 if (isspace(
static_cast<unsigned char>(*fmt))) {
6603 if (is.rdstate() == ios::goodbit && command) {
6604 if (modified == CharT{})
6605 read(is, CharT{
'%' }, width);
6607 read(is, CharT{
'%' }, width, modified);
6610 if (y != not_a_2digit_year) {
6612 if (!(0 <= y && y <= 99))
6614 if (C == not_a_century) {
6615 if (Y == not_a_year) {
6621 C = (Y >= 0 ? Y : Y - 100) / 100;
6628 tY = 100 * (C + 1) - (y == 0 ? 100 : y);
6629 if (Y != not_a_year && Y != tY)
6633 if (g != not_a_2digit_year) {
6635 if (!(0 <= g && g <= 99))
6637 if (C == not_a_century) {
6638 if (G == not_a_year) {
6644 C = (G >= 0 ? G : G - 100) / 100;
6651 tG = 100 * (C + 1) - (g == 0 ? 100 : g);
6652 if (G != not_a_year && G != tG)
6658 bool computed =
false;
6659 if (G != not_a_year && V != not_a_week_num && wd != not_a_weekday) {
6664 if (Y == not_a_year)
6665 Y =
static_cast<int>(ymd_trial.
year());
6666 else if (
year{ Y } != ymd_trial.
year())
6668 if (m == not_a_month)
6669 m =
static_cast<int>(
static_cast<unsigned>(ymd_trial.
month()));
6670 else if (
month(
static_cast<unsigned>(m)) != ymd_trial.
month())
6673 d =
static_cast<int>(
static_cast<unsigned>(ymd_trial.
day()));
6674 else if (
day(
static_cast<unsigned>(d)) != ymd_trial.
day())
6678 if (Y != not_a_year && U != not_a_week_num && wd != not_a_weekday) {
6682 if (Y == not_a_year)
6683 Y =
static_cast<int>(ymd_trial.
year());
6684 else if (
year{ Y } != ymd_trial.
year())
6686 if (m == not_a_month)
6687 m =
static_cast<int>(
static_cast<unsigned>(ymd_trial.
month()));
6688 else if (
month(
static_cast<unsigned>(m)) != ymd_trial.
month())
6691 d =
static_cast<int>(
static_cast<unsigned>(ymd_trial.
day()));
6692 else if (
day(
static_cast<unsigned>(d)) != ymd_trial.
day())
6696 if (Y != not_a_year && W != not_a_week_num && wd != not_a_weekday) {
6700 if (Y == not_a_year)
6701 Y =
static_cast<int>(ymd_trial.
year());
6702 else if (
year{ Y } != ymd_trial.
year())
6704 if (m == not_a_month)
6705 m =
static_cast<int>(
static_cast<unsigned>(ymd_trial.
month()));
6706 else if (
month(
static_cast<unsigned>(m)) != ymd_trial.
month())
6709 d =
static_cast<int>(
static_cast<unsigned>(ymd_trial.
day()));
6710 else if (
day(
static_cast<unsigned>(d)) != ymd_trial.
day())
6714 if (
j != not_a_doy && Y != not_a_year) {
6717 if (m == not_a_month)
6718 m =
static_cast<int>(
static_cast<unsigned>(ymd_trial.month()));
6719 else if (
month(
static_cast<unsigned>(m)) != ymd_trial.
month())
6722 d =
static_cast<int>(
static_cast<unsigned>(ymd_trial.day()));
6723 else if (
day(
static_cast<unsigned>(d)) != ymd_trial.day())
6727 auto ymd =
year{ Y } / m / d;
6729 if (wd == not_a_weekday)
6735 if (G != not_a_year || V != not_a_week_num) {
6743 if (V != not_a_week_num)
6748 if (G != not_a_year && G !=
static_cast<int>(G_trial))
6750 if (V != not_a_week_num) {
6751 auto V_trial = duration_cast<weeks>(sd - start).count() + 1;
6756 if (U != not_a_week_num) {
6758 auto U_trial = floor<weeks>(
sys_days(ymd) - start).count() + 1;
6762 if (W != not_a_week_num) {
6764 auto W_trial = floor<weeks>(
sys_days(ymd) - start).count() + 1;
6771 if (I != not_a_hour_12_value) {
6772 if (!(1 <= I && I <= 12))
6774 if (p != not_a_ampm) {
6781 if (H == not_a_hour)
6788 if (H != not_a_hour) {
6790 if (H != 0 && H != 12)
6792 }
else if (!(I == H || I == H + 12)) {
6799 if (H != not_a_hour) {
6803 if (M != not_a_minute) {
6805 fds.
tod.m_ = minutes{ M };
6807 if (
s != not_a_second) {
6811 if (
j != not_a_doy) {
6815 if (wd != not_a_weekday)
6816 fds.
wd =
weekday{
static_cast<unsigned>(wd) };
6817 if (abbrev !=
nullptr)
6818 *abbrev = std::move(temp_abbrev);
6819 if (offset !=
nullptr && temp_offset != not_a_offset)
6820 *offset = temp_offset;
6825 is.setstate(ios::failbit);
6829template <
class CharT,
class Traits,
class Alloc = std::allocator<CharT>>
6830std::basic_istream<CharT, Traits>&
6834 std::basic_string<CharT, Traits, Alloc>* abbrev =
nullptr,
6835 std::chrono::minutes* offset =
nullptr)
6837 using CT = std::chrono::seconds;
6840 if (!fds.ymd.year().ok())
6841 is.setstate(std::ios::failbit);
6847template <
class CharT,
class Traits,
class Alloc = std::allocator<CharT>>
6848std::basic_istream<CharT, Traits>&
6852 std::basic_string<CharT, Traits, Alloc>* abbrev =
nullptr,
6853 std::chrono::minutes* offset =
nullptr)
6855 using CT = std::chrono::seconds;
6858 if (!fds.ymd.month().ok())
6859 is.setstate(std::ios::failbit);
6861 m = fds.ymd.
month();
6865template <
class CharT,
class Traits,
class Alloc = std::allocator<CharT>>
6866std::basic_istream<CharT, Traits>&
6870 std::basic_string<CharT, Traits, Alloc>* abbrev =
nullptr,
6871 std::chrono::minutes* offset =
nullptr)
6873 using CT = std::chrono::seconds;
6876 if (!fds.ymd.day().ok())
6877 is.setstate(std::ios::failbit);
6883template <
class CharT,
class Traits,
class Alloc = std::allocator<CharT>>
6884std::basic_istream<CharT, Traits>&
6888 std::basic_string<CharT, Traits, Alloc>* abbrev =
nullptr,
6889 std::chrono::minutes* offset =
nullptr)
6891 using CT = std::chrono::seconds;
6895 is.setstate(std::ios::failbit);
6901template <
class CharT,
class Traits,
class Alloc = std::allocator<CharT>>
6902std::basic_istream<CharT, Traits>&
6906 std::basic_string<CharT, Traits, Alloc>* abbrev =
nullptr,
6907 std::chrono::minutes* offset =
nullptr)
6909 using CT = std::chrono::seconds;
6912 if (!fds.ymd.month().ok())
6913 is.setstate(std::ios::failbit);
6915 ym = fds.ymd.
year() / fds.ymd.month();
6919template <
class CharT,
class Traits,
class Alloc = std::allocator<CharT>>
6920std::basic_istream<CharT, Traits>&
6924 std::basic_string<CharT, Traits, Alloc>* abbrev =
nullptr,
6925 std::chrono::minutes* offset =
nullptr)
6927 using CT = std::chrono::seconds;
6930 if (!fds.ymd.month().ok() || !fds.ymd.day().ok())
6931 is.setstate(std::ios::failbit);
6933 md = fds.ymd.
month() / fds.ymd.day();
6937template <
class CharT,
class Traits,
class Alloc = std::allocator<CharT>>
6938std::basic_istream<CharT, Traits>&
6942 std::basic_string<CharT, Traits, Alloc>* abbrev =
nullptr,
6943 std::chrono::minutes* offset =
nullptr)
6945 using CT = std::chrono::seconds;
6949 is.setstate(std::ios::failbit);
6955template <
class Duration,
class CharT,
class Traits,
class Alloc = std::allocator<CharT>>
6956std::basic_istream<CharT, Traits>&
6960 std::basic_string<CharT, Traits, Alloc>* abbrev =
nullptr,
6961 std::chrono::minutes* offset =
nullptr)
6963 using CT =
typename std::common_type<Duration, std::chrono::seconds>::type;
6965 std::chrono::minutes offset_local{};
6966 auto offptr = offset ? offset : &offset_local;
6970 if (!fds.ymd.ok() || !fds.tod.in_conventional_range())
6971 is.setstate(std::ios::failbit);
6973 tp = round_i<Duration>(
sys_days(fds.ymd) - *offptr + fds.tod.to_duration());
6977template <
class Duration,
class CharT,
class Traits,
class Alloc = std::allocator<CharT>>
6978std::basic_istream<CharT, Traits>&
6982 std::basic_string<CharT, Traits, Alloc>* abbrev =
nullptr,
6983 std::chrono::minutes* offset =
nullptr)
6985 using CT =
typename std::common_type<Duration, std::chrono::seconds>::type;
6990 if (!fds.ymd.ok() || !fds.tod.in_conventional_range())
6991 is.setstate(std::ios::failbit);
6994 fds.tod.to_duration());
7002 class Alloc = std::allocator<CharT>>
7003std::basic_istream<CharT, Traits>&
7006 std::chrono::duration<Rep, Period>& d,
7007 std::basic_string<CharT, Traits, Alloc>* abbrev =
nullptr,
7008 std::chrono::minutes* offset =
nullptr)
7010 using Duration = std::chrono::duration<Rep, Period>;
7011 using CT =
typename std::common_type<Duration, std::chrono::seconds>::type;
7016 is.setstate(std::ios::failbit);
7018 d = round_i<Duration>(fds.tod.to_duration());
7022template <
class Parsable,
7024 class Traits = std::char_traits<CharT>,
7025 class Alloc = std::allocator<CharT>>
7027 const std::basic_string<CharT, Traits, Alloc> format_;
7029 std::basic_string<CharT, Traits, Alloc>* abbrev_;
7030 std::chrono::minutes* offset_;
7033 parse_manip(std::basic_string<CharT, Traits, Alloc>
format,
7035 std::basic_string<CharT, Traits, Alloc>* abbrev =
nullptr,
7036 std::chrono::minutes* offset =
nullptr)
7037 : format_(std::move(
format)), tp_(tp), abbrev_(abbrev), offset_(offset)
7042 parse_manip(
const CharT*
format,
7044 std::basic_string<CharT, Traits, Alloc>* abbrev =
nullptr,
7045 std::chrono::minutes* offset =
nullptr)
7046 : format_(
format), tp_(tp), abbrev_(abbrev), offset_(offset)
7050 parse_manip(std::basic_string_view<CharT, Traits>
format,
7052 std::basic_string<CharT, Traits, Alloc>* abbrev =
nullptr,
7053 std::chrono::minutes* offset =
nullptr)
7054 : format_(
format), tp_(tp), abbrev_(abbrev), offset_(offset)
7060template <
class Parsable,
class CharT,
class Traits,
class Alloc>
7061std::basic_istream<CharT, Traits>&
7063 const parse_manip<Parsable, CharT, Traits, Alloc>& x)
7068template <
class Parsable,
class CharT,
class Traits,
class Alloc>
7069inline auto parse(
const std::basic_string<CharT, Traits, Alloc>&
format, Parsable& tp)
7070 ->
decltype(
date::from_stream(std::declval<std::basic_istream<CharT, Traits>&>(),
7073 parse_manip<Parsable, CharT, Traits, Alloc>{
format, tp })
7078template <
class Parsable,
class CharT,
class Traits,
class Alloc>
7079inline auto parse(
const std::basic_string<CharT, Traits, Alloc>&
format,
7081 std::basic_string<CharT, Traits, Alloc>& abbrev)
7082 ->
decltype(
date::from_stream(std::declval<std::basic_istream<CharT, Traits>&>(),
7086 parse_manip<Parsable, CharT, Traits, Alloc>{
format, tp, &abbrev })
7088 return {
format, tp, &abbrev };
7091template <
class Parsable,
class CharT,
class Traits,
class Alloc>
7092inline auto parse(
const std::basic_string<CharT, Traits, Alloc>&
format,
7094 std::chrono::minutes& offset)
7099 std::declval<std::basic_string<CharT, Traits, Alloc>*>(),
7101 parse_manip<Parsable, CharT, Traits, Alloc>{
format, tp,
nullptr, &offset })
7103 return {
format, tp,
nullptr, &offset };
7106template <
class Parsable,
class CharT,
class Traits,
class Alloc>
7107inline auto parse(
const std::basic_string<CharT, Traits, Alloc>&
format,
7109 std::basic_string<CharT, Traits, Alloc>& abbrev,
7110 std::chrono::minutes& offset)
7111 ->
decltype(
date::from_stream(std::declval<std::basic_istream<CharT, Traits>&>(),
7116 parse_manip<Parsable, CharT, Traits, Alloc>{
7117 format, tp, &abbrev, &offset })
7119 return {
format, tp, &abbrev, &offset };
7124template <
class Parsable,
class CharT>
7125inline auto parse(
const CharT*
format, Parsable& tp)
7127 parse_manip<Parsable, CharT>{
format, tp })
7132template <
class Parsable,
class CharT,
class Traits,
class Alloc>
7134parse(
const CharT*
format, Parsable& tp, std::basic_string<CharT, Traits, Alloc>& abbrev)
7135 ->
decltype(
date::from_stream(std::declval<std::basic_istream<CharT, Traits>&>(),
7139 parse_manip<Parsable, CharT, Traits, Alloc>{
format, tp, &abbrev })
7141 return {
format, tp, &abbrev };
7144template <
class Parsable,
class CharT>
7145inline auto parse(
const CharT*
format, Parsable& tp, std::chrono::minutes& offset)
7149 std::declval<std::basic_string<CharT>*>(),
7151 parse_manip<Parsable, CharT>{
format, tp,
nullptr, &offset })
7153 return {
format, tp,
nullptr, &offset };
7156template <
class Parsable,
class CharT,
class Traits,
class Alloc>
7159 std::basic_string<CharT, Traits, Alloc>& abbrev,
7160 std::chrono::minutes& offset)
7161 ->
decltype(
date::from_stream(std::declval<std::basic_istream<CharT, Traits>&>(),
7166 parse_manip<Parsable, CharT, Traits, Alloc>{
7167 format, tp, &abbrev, &offset })
7169 return {
format, tp, &abbrev, &offset };
7174template <
class CharT,
class Traits,
class Rep,
class Period>
7175inline std::basic_ostream<CharT, Traits>&
7176operator<<(std::basic_ostream<CharT, Traits>& os,
7177 const std::chrono::duration<Rep, Period>& d)
7179 return os << detail::make_string<CharT, Traits>::from(d.count()) +
7180 detail::get_units<CharT>(
typename Period::type{});
7190#pragma GCC diagnostic pop
CONSTCD14 day & operator-=(const days &d) NOEXCEPT
Definition: date.h:1358
CONSTCD14 day & operator--() NOEXCEPT
Definition: date.h:1342
CONSTCD11 bool ok() const NOEXCEPT
Definition: date.h:1364
CONSTCD14 day & operator++() NOEXCEPT
Definition: date.h:1331
CONSTCD14 day & operator+=(const days &d) NOEXCEPT
Definition: date.h:1353
save_istream(std::basic_ios< CharT, Traits > &is)
Definition: date.h:1026
std::streamsize precision_
Definition: date.h:1007
std::streamsize width_
Definition: date.h:1008
save_istream(const save_istream &)=delete
std::basic_ostream< CharT, Traits > * tie_
Definition: date.h:1009
save_istream & operator=(const save_istream &)=delete
std::basic_ios< CharT, Traits > & is_
Definition: date.h:1004
~save_istream()
Definition: date.h:1013
std::ios::fmtflags flags_
Definition: date.h:1006
std::locale loc_
Definition: date.h:1010
CharT fill_
Definition: date.h:1005
~save_ostream()
Definition: date.h:1044
save_ostream(const save_ostream &)=delete
save_ostream(std::basic_ios< CharT, Traits > &os)
Definition: date.h:1059
save_ostream & operator=(const save_ostream &)=delete
CONSTCD14 std::chrono::seconds & seconds(detail::undocumented) NOEXCEPT
Definition: date.h:3537
CONSTCD11 hh_mm_ss() NOEXCEPT
Definition: date.h:3524
CONSTCD11 bool is_negative() const NOEXCEPT
Definition: date.h:3542
CONSTCD11 std::chrono::minutes minutes() const NOEXCEPT
Definition: date.h:3535
CONSTCD11 precision subseconds() const NOEXCEPT
Definition: date.h:3541
CONSTCD11 std::chrono::hours hours() const NOEXCEPT
Definition: date.h:3534
CONSTCD11 bool in_conventional_range() const NOEXCEPT
Definition: date.h:3550
CONSTCD11 std::chrono::seconds seconds() const NOEXCEPT
Definition: date.h:3536
CONSTCD11 precision to_duration() const NOEXCEPT
Definition: date.h:3545
CONSTCD11 hh_mm_ss(Duration d) NOEXCEPT
Definition: date.h:3526
typename dfs::precision precision
Definition: date.h:3522
CONSTCD11 bool ok() const NOEXCEPT
Definition: date.h:2204
CONSTCD11 date::month month() const NOEXCEPT
Definition: date.h:2203
CONSTCD11 month_day_last(const date::month &m) NOEXCEPT
Definition: date.h:2205
CONSTCD14 bool ok() const NOEXCEPT
Definition: date.h:2136
CONSTCD11 date::day day() const NOEXCEPT
Definition: date.h:2133
CONSTCD11 date::month month() const NOEXCEPT
Definition: date.h:2132
CONSTCD11 month_weekday_last(const date::month &m, const date::weekday_last &wd) NOEXCEPT
Definition: date.h:2318
CONSTCD11 bool ok() const NOEXCEPT
Definition: date.h:2331
CONSTCD11 date::month month() const NOEXCEPT
Definition: date.h:2325
CONSTCD11 date::weekday_last weekday_last() const NOEXCEPT
Definition: date.h:2328
CONSTCD11 month_weekday(const date::month &m, const date::weekday_indexed &wdi) NOEXCEPT
Definition: date.h:2267
CONSTCD11 date::weekday_indexed weekday_indexed() const NOEXCEPT
Definition: date.h:2276
CONSTCD11 bool ok() const NOEXCEPT
Definition: date.h:2279
CONSTCD11 date::month month() const NOEXCEPT
Definition: date.h:2273
CONSTCD14 month & operator--() NOEXCEPT
Definition: date.h:1449
CONSTCD14 month & operator++() NOEXCEPT
Definition: date.h:1438
CONSTCD14 month & operator-=(const months &m) NOEXCEPT
Definition: date.h:1469
CONSTCD11 bool ok() const NOEXCEPT
Definition: date.h:1476
CONSTCD14 month & operator+=(const months &m) NOEXCEPT
Definition: date.h:1462
weekday_indexed()=default
CONSTCD11 unsigned index() const NOEXCEPT
Definition: date.h:1874
CONSTCD11 bool ok() const NOEXCEPT
Definition: date.h:1877
CONSTCD11 date::weekday weekday() const NOEXCEPT
Definition: date.h:1869
CONSTCD11 bool ok() const NOEXCEPT
Definition: date.h:1940
CONSTCD11 weekday_last(const date::weekday &wd) NOEXCEPT
Definition: date.h:1941
CONSTCD11 date::weekday weekday() const NOEXCEPT
Definition: date.h:1939
CONSTCD14 weekday & operator-=(const days &d) NOEXCEPT
Definition: date.h:1728
CONSTCD11 unsigned c_encoding() const NOEXCEPT
Definition: date.h:1737
CONSTCD14 weekday & operator--() NOEXCEPT
Definition: date.h:1708
CONSTCD11 weekday_indexed operator[](unsigned index) const NOEXCEPT
Definition: date.h:1920
CONSTCD11 unsigned iso_encoding() const NOEXCEPT
Definition: date.h:1740
CONSTCD14 weekday & operator++() NOEXCEPT
Definition: date.h:1697
CONSTCD11 bool ok() const NOEXCEPT
Definition: date.h:1734
CONSTCD14 weekday & operator+=(const days &d) NOEXCEPT
Definition: date.h:1721
CONSTCD11 year_month_day_last(const date::year &y, const date::month_day_last &mdl) NOEXCEPT
Definition: date.h:2370
CONSTCD14 year_month_day_last & operator+=(const months &m) NOEXCEPT
Definition: date.h:2379
CONSTCD11 date::month month() const NOEXCEPT
Definition: date.h:2408
CONSTCD11 date::month_day_last month_day_last() const NOEXCEPT
Definition: date.h:2414
CONSTCD14 date::day day() const NOEXCEPT
Definition: date.h:2420
CONSTCD14 year_month_day_last & operator-=(const months &m) NOEXCEPT
Definition: date.h:2387
CONSTCD11 bool ok() const NOEXCEPT
Definition: date.h:2444
CONSTCD11 date::year year() const NOEXCEPT
Definition: date.h:2407
CONSTCD11 date::year year() const NOEXCEPT
Definition: date.h:2584
CONSTCD14 bool ok() const NOEXCEPT
Definition: date.h:2646
CONSTCD14 year_month_day & operator-=(const months &m) NOEXCEPT
Definition: date.h:2596
CONSTCD11 date::day day() const NOEXCEPT
Definition: date.h:2586
CONSTCD14 year_month_day & operator+=(const months &m) NOEXCEPT
Definition: date.h:2589
CONSTCD11 date::month month() const NOEXCEPT
Definition: date.h:2585
CONSTCD11 bool ok() const NOEXCEPT
Definition: date.h:3022
CONSTCD11 year_month_weekday_last(const date::year &y, const date::month &m, const date::weekday_last &wdl) NOEXCEPT
Definition: date.h:2954
CONSTCD14 year_month_weekday_last & operator+=(const months &m) NOEXCEPT
Definition: date.h:2964
CONSTCD11 date::weekday weekday() const NOEXCEPT
Definition: date.h:2998
CONSTCD11 date::month month() const NOEXCEPT
Definition: date.h:2995
CONSTCD14 year_month_weekday_last & operator-=(const months &m) NOEXCEPT
Definition: date.h:2972
CONSTCD11 date::weekday_last weekday_last() const NOEXCEPT
Definition: date.h:3004
CONSTCD11 date::year year() const NOEXCEPT
Definition: date.h:2994
CONSTCD14 year_month_weekday & operator-=(const months &m) NOEXCEPT
Definition: date.h:2805
CONSTCD11 unsigned index() const NOEXCEPT
Definition: date.h:2832
CONSTCD11 date::weekday_indexed weekday_indexed() const NOEXCEPT
Definition: date.h:2835
CONSTCD11 date::year year() const NOEXCEPT
Definition: date.h:2825
CONSTCD14 bool ok() const NOEXCEPT
Definition: date.h:2853
CONSTCD11 date::month month() const NOEXCEPT
Definition: date.h:2826
year_month_weekday()=default
CONSTCD11 date::weekday weekday() const NOEXCEPT
Definition: date.h:2829
CONSTCD14 year_month_weekday & operator+=(const months &m) NOEXCEPT
Definition: date.h:2797
CONSTCD14 year_month & operator+=(const months &dm) NOEXCEPT
Definition: date.h:1995
CONSTCD14 year_month & operator-=(const months &dm) NOEXCEPT
Definition: date.h:2002
CONSTCD11 date::month month() const NOEXCEPT
Definition: date.h:1991
CONSTCD11 date::year year() const NOEXCEPT
Definition: date.h:1990
CONSTCD11 bool ok() const NOEXCEPT
Definition: date.h:1992
CONSTCD11 year operator+() const NOEXCEPT
Definition: date.h:1585
CONSTCD11 bool is_leap() const NOEXCEPT
Definition: date.h:1588
CONSTCD11 bool ok() const NOEXCEPT
Definition: date.h:1596
CONSTCD11 year operator-() const NOEXCEPT
Definition: date.h:1584
CONSTCD14 year & operator++() NOEXCEPT
Definition: date.h:1552
static CONSTCD11 year max() NOEXCEPT
Definition: date.h:410
CONSTCD14 year & operator--() NOEXCEPT
Definition: date.h:1563
CONSTCD14 year & operator-=(const years &y) NOEXCEPT
Definition: date.h:1579
static CONSTCD11 year min() NOEXCEPT
Definition: date.h:409
CONSTCD14 year & operator+=(const years &y) NOEXCEPT
Definition: date.h:1574
#define NOEXCEPT
Definition: date.h:134
#define CONSTDATA
Definition: date.h:131
#define CONSTCD14
Definition: date.h:133
#define CONSTCD11
Definition: date.h:132
#define HAS_UNCAUGHT_EXCEPTIONS
Definition: date.h:141
data_t loc[NROOTS]
Definition: decode_rs.h:78
int j
Definition: decode_rs.h:73
int r
Definition: decode_rs.h:73
data_t den
Definition: decode_rs.h:74
data_t s[NROOTS]
Definition: decode_rs.h:75
data_t u
Definition: decode_rs.h:74
data_t tmp
Definition: decode_rs.h:74
data_t t[NROOTS+1]
Definition: decode_rs.h:77
int i
Definition: decode_rs.h:73
int count
Definition: decode_rs.h:79
unsigned read_unsigned(std::basic_istream< CharT, Traits > &is, unsigned m=1, unsigned M=10)
Definition: date.h:5371
void checked_set(T &value, T from, T not_a_value, std::basic_ios< CharT, Traits > &is)
Definition: date.h:5568
CONSTCD11 std::chrono::time_point< Clock, To > round_i(const std::chrono::time_point< Clock, FromDuration > &tp)
Definition: date.h:1311
void read(std::basic_istream< CharT, Traits > &is, rld a0, Args &&... args)
Definition: date.h:5557
CONSTCD11 std::enable_if<!std::numeric_limits< Rep >::is_signed, std::chrono::duration< Rep, Period > >::type abs(std::chrono::duration< Rep, Period > d)
Definition: date.h:3502
CONSTCD14 std::enable_if<!std::chrono::treat_as_floating_point< typenameTo::rep >::value, To >::type round_i(const std::chrono::duration< Rep, Period > &d)
Definition: date.h:1295
CONSTCD11 std::enable_if< std::numeric_limits< Rep >::is_signed, std::chrono::duration< Rep, Period > >::type abs(std::chrono::duration< Rep, Period > d)
Definition: date.h:3494
decltype(std::ratio_divide< R1, R2 >{}) ratio_divide
Definition: date.h:166
void read(std::basic_istream< CharT, Traits > &)
Definition: date.h:5479
int read_signed(std::basic_istream< CharT, Traits > &is, unsigned m=1, unsigned M=10)
Definition: date.h:5394
decltype(std::ratio_multiply< R1, R2 >{}) ratio_multiply
Definition: date.h:163
unsigned extract_month(std::basic_ostream< CharT, Traits > &os, const fields< Duration > &fds)
Definition: date.h:4120
unsigned extract_weekday(std::basic_ostream< CharT, Traits > &os, const fields< Duration > &fds)
Definition: date.h:4098
bool read_char(std::basic_istream< CharT, Traits > &is, CharT fmt, std::ios::iostate &err)
Definition: date.h:5357
std::basic_ostream< CharT, Traits > & low_level_fmt(std::basic_ostream< CharT, Traits > &os, const day &d)
Definition: date.h:1412
long double read_long_double(std::basic_istream< CharT, Traits > &is, unsigned m=1, unsigned M=10)
Definition: date.h:5417
CONSTCD11 std::enable_if<!std::chrono::treat_as_floating_point< T >::value, T >::type trunc(T t) NOEXCEPT
Definition: date.h:1082
std::basic_ostream< CharT, Traits > & low_level_fmt(std::basic_ostream< CharT, Traits > &os, const year_month_day_last &ymdl)
Definition: date.h:2492
CONSTDATA date::month apr
Definition: date.h:1823
CONSTDATA date::weekday tue
Definition: date.h:1835
CONSTDATA date::month nov
Definition: date.h:1830
CONSTDATA date::month jun
Definition: date.h:1825
CONSTDATA date::weekday mon
Definition: date.h:1834
CONSTDATA date::month jul
Definition: date.h:1826
CONSTDATA date::weekday wed
Definition: date.h:1836
CONSTDATA date::last_spec last
Definition: date.h:1818
CONSTDATA date::month oct
Definition: date.h:1829
CONSTDATA date::month feb
Definition: date.h:1821
CONSTDATA date::month sep
Definition: date.h:1828
CONSTDATA date::weekday fri
Definition: date.h:1838
CONSTDATA date::month aug
Definition: date.h:1827
CONSTDATA date::month dec
Definition: date.h:1831
CONSTDATA date::month may
Definition: date.h:1824
CONSTDATA date::weekday sun
Definition: date.h:1833
CONSTDATA date::weekday sat
Definition: date.h:1839
CONSTDATA date::weekday thu
Definition: date.h:1837
CONSTDATA date::month mar
Definition: date.h:1822
CONSTDATA date::month jan
Definition: date.h:1820
CONSTDATA date::weekday Friday
Definition: date.h:1862
CONSTCD11 bool operator>=(const day &x, const day &y) NOEXCEPT
Definition: date.h:1388
CONSTCD14 To round(const std::chrono::duration< Rep, Period > &d)
Definition: date.h:1218
CONSTDATA year nanyear
Definition: date.h:4062
CONSTCD14 std::chrono::hours make12(std::chrono::hours h) NOEXCEPT
Definition: date.h:3601
local_time< std::chrono::seconds > local_seconds
Definition: date.h:202
CONSTCD11 day operator+(const day &x, const days &y) NOEXCEPT
Definition: date.h:1398
CONSTCD11 std::chrono::time_point< Clock, To > round(const std::chrono::time_point< Clock, FromDuration > &tp)
Definition: date.h:1266
CONSTCD11 day operator-(const day &x, const days &y) NOEXCEPT
Definition: date.h:1407
std::basic_ostream< CharT, Traits > & to_stream(std::basic_ostream< CharT, Traits > &os, const CharT *fmt, const fields< Duration > &fds, const std::string *abbrev=nullptr, const std::chrono::seconds *offset_sec=nullptr)
Definition: date.h:4255
std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &os, const day &d)
Definition: date.h:1427
local_time< days > local_days
Definition: date.h:203
CONSTDATA date::month May
Definition: date.h:1849
std::chrono::duration< int, detail::ratio_multiply< std::ratio< 24 >, std::chrono::hours::period > > days
Definition: date.h:176
auto format(const std::locale &loc, const CharT *fmt, const Streamable &tp) -> decltype(to_stream(std::declval< std::basic_ostream< CharT > & >(), fmt, tp), std::basic_string< CharT >{})
Definition: date.h:5301
std::chrono::duration< int, detail::ratio_divide< years::period, std::ratio< 12 > > > months
Definition: date.h:186
CONSTCD14 bool is_am(std::chrono::hours const &h) NOEXCEPT
Definition: date.h:3589
CONSTDATA date::month August
Definition: date.h:1852
CONSTDATA date::weekday Saturday
Definition: date.h:1863
CONSTDATA date::month January
Definition: date.h:1845
CONSTDATA date::month October
Definition: date.h:1854
CONSTCD11 bool operator>(const day &x, const day &y) NOEXCEPT
Definition: date.h:1382
CONSTDATA date::weekday Wednesday
Definition: date.h:1860
CONSTCD11 year_month operator/(const year &y, const month &m) NOEXCEPT
Definition: date.h:3106
std::chrono::duration< int, detail::ratio_multiply< std::ratio< 146097, 400 >, days::period > > years
Definition: date.h:183
CONSTCD14 std::chrono::hours make24(std::chrono::hours h, bool is_pm) NOEXCEPT
Definition: date.h:3614
CONSTCD11 bool operator==(const day &x, const day &y) NOEXCEPT
Definition: date.h:1367
std::chrono::time_point< std::chrono::system_clock, Duration > sys_time
Definition: date.h:191
CONSTCD11 std::chrono::time_point< Clock, To > floor(const std::chrono::time_point< Clock, FromDuration > &tp)
Definition: date.h:1257
CONSTCD14 std::enable_if< detail::no_overflow< Period, typenameTo::period >::value, To >::type floor(const std::chrono::duration< Rep, Period > &d)
Definition: date.h:1198
CONSTDATA date::weekday Tuesday
Definition: date.h:1859
CONSTCD11 hh_mm_ss< std::chrono::duration< Rep, Period > > make_time(const std::chrono::duration< Rep, Period > &d)
Definition: date.h:3630
std::basic_istream< CharT, Traits > & from_stream(std::basic_istream< CharT, Traits > &is, const CharT *fmt, fields< Duration > &fds, std::basic_string< CharT, Traits, Alloc > *abbrev=nullptr, std::chrono::minutes *offset=nullptr)
Definition: date.h:5582
CONSTDATA date::month December
Definition: date.h:1856
CONSTCD11 std::chrono::duration< Rep, Period > abs(std::chrono::duration< Rep, Period > d)
Definition: date.h:1249
std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > &is, const parse_manip< Parsable, CharT, Traits, Alloc > &x)
Definition: date.h:7062
CONSTCD11 bool operator!=(const day &x, const day &y) NOEXCEPT
Definition: date.h:1373
CONSTDATA date::weekday Sunday
Definition: date.h:1864
CONSTDATA date::weekday Monday
Definition: date.h:1858
CONSTCD11 std::enable_if< detail::no_overflow< Period, typenameTo::period >::value, To >::type trunc(const std::chrono::duration< Rep, Period > &d)
Definition: date.h:1160
CONSTCD11 std::chrono::time_point< Clock, To > ceil(const std::chrono::time_point< Clock, FromDuration > &tp)
Definition: date.h:1275
CONSTCD14 bool is_pm(std::chrono::hours const &h) NOEXCEPT
Definition: date.h:3595
CONSTCD11 bool operator<=(const day &x, const day &y) NOEXCEPT
Definition: date.h:1385
CONSTDATA date::month July
Definition: date.h:1851
CONSTDATA date::month April
Definition: date.h:1848
CONSTDATA date::month November
Definition: date.h:1855
CONSTDATA date::weekday Thursday
Definition: date.h:1861
CONSTCD11 bool operator<(const day &x, const day &y) NOEXCEPT
Definition: date.h:1376
std::chrono::duration< int, detail::ratio_multiply< std::ratio< 7 >, days::period > > weeks
Definition: date.h:179
CONSTDATA date::month February
Definition: date.h:1846
std::chrono::time_point< local_t, Duration > local_time
Definition: date.h:200
sys_time< std::chrono::seconds > sys_seconds
Definition: date.h:194
CONSTDATA date::month March
Definition: date.h:1847
sys_time< days > sys_days
Definition: date.h:193
CONSTCD14 To ceil(const std::chrono::duration< Rep, Period > &d)
Definition: date.h:1238
CONSTDATA date::month September
Definition: date.h:1853
CONSTDATA date::month June
Definition: date.h:1850
typename std::conditional< digits< 32, std::int32_t, typename std::conditional< digits< 64, std::int64_t, std::int64_t >::type >::type type
Definition: date.h:1076
std::ratio< mul< n1, d2, !value >::value, mul< n2, d1, !value >::value > type
Definition: date.h:1150
unsigned m
Definition: date.h:5474
long double & i
Definition: date.h:5473
unsigned M
Definition: date.h:5475
unsigned M
Definition: date.h:5463
unsigned m
Definition: date.h:5462
int & i
Definition: date.h:5461
unsigned m
Definition: date.h:5468
unsigned M
Definition: date.h:5469
int & i
Definition: date.h:5467
hh_mm_ss< Duration > tod
Definition: date.h:4068
fields(year_month_day ymd_, weekday wd_)
Definition: date.h:4081
fields(year_month_day ymd_, hh_mm_ss< Duration > tod_)
Definition: date.h:4082
fields(year_month_day ymd_, weekday wd_, hh_mm_ss< Duration > tod_)
Definition: date.h:4089
year_month_day ymd
Definition: date.h:4066
fields(weekday wd_)
Definition: date.h:4078
weekday wd
Definition: date.h:4067
fields(hh_mm_ss< Duration > tod_)
Definition: date.h:4079
fields(year_month_day ymd_)
Definition: date.h:4077
bool has_tod
Definition: date.h:4069
fields(weekday wd_, hh_mm_ss< Duration > tod_)
Definition: date.h:4087
Definition: rs-common.h:7