53# define HAS_REMOTE_API 0
55# define HAS_REMOTE_API 1
58# define HAS_REMOTE_API 0
63# pragma clang diagnostic push
64# pragma clang diagnostic ignored "-Wconstant-logical-operand"
68 "USE_OS_TZDB and HAS_REMOTE_API can not be used together");
71# pragma clang diagnostic pop
75# define AUTO_DOWNLOAD HAS_REMOTE_API
79 "AUTO_DOWNLOAD can not be turned on without HAS_REMOTE_API");
82# define USE_SHELL_API 1
87# error "USE_OS_TZDB can not be used on Windows"
91#ifndef HAS_DEDUCTION_GUIDES
92# if __cplusplus >= 201703
93# define HAS_DEDUCTION_GUIDES 1
95# define HAS_DEDUCTION_GUIDES 0
101#if defined(_MSC_VER) && (_MSC_VER < 1900)
117#include <type_traits>
122# ifdef DATE_BUILD_DLL
123# define DATE_API __declspec(dllexport)
124# elif defined(DATE_USE_DLL)
125# define DATE_API __declspec(dllimport)
130# ifdef DATE_BUILD_DLL
131# define DATE_API __attribute__ ((visibility ("default")))
165template<
class CharT,
class Traits>
166std::basic_ostream<CharT, Traits>&
169 os << r.
begin <<
'\n';
184template<
class CharT,
class Traits>
185std::basic_ostream<CharT, Traits>&
189 os <<
"nonexistent between\n";
191 os <<
"ambiguous between\n";
202 :
public std::runtime_error
205 template <
class Duration>
209 template <
class Duration>
215template <
class Duration>
219 : std::runtime_error(make_msg(tp, i))
223template <
class Duration>
228 std::ostringstream os;
229 os << tp <<
" is in a gap between\n"
234 <<
" which are both equivalent to\n"
240 :
public std::runtime_error
243 template <
class Duration>
247 template <
class Duration>
253template <
class Duration>
256 : std::runtime_error(make_msg(tp, i))
260template <
class Duration>
265 std::ostringstream os;
266 os << tp <<
" is ambiguous. It could be\n"
327template <
class Duration,
class TimeZonePtr>
330template <
class Duration1,
class Duration2,
class TimeZonePtr>
332operator==(
const zoned_time<Duration1, TimeZonePtr>& x,
333 const zoned_time<Duration2, TimeZonePtr>& y);
335template <
class Duration,
class TimeZonePtr = const time_zone*>
339 using duration =
typename std::common_type<Duration, std::chrono::seconds>::type;
346#if !defined(_MSC_VER) || (_MSC_VER > 1916)
347 template <
class T = TimeZonePtr,
352#if !defined(_MSC_VER) || (_MSC_VER > 1916)
353 template <
class T = TimeZonePtr,
360 template <
class T = TimeZonePtr,
361 class =
typename std::enable_if
363 std::is_constructible
371# if !defined(_MSC_VER) || (_MSC_VER > 1916)
372 template <
class T = TimeZonePtr,
373 class =
typename std::enable_if
375 std::is_constructible
385 template <
class Duration2,
386 class =
typename std::enable_if
388 std::is_convertible<sys_time<Duration2>,
395#if !defined(_MSC_VER) || (_MSC_VER > 1916)
396 template <
class T = TimeZonePtr,
397 class =
typename std::enable_if
408#if !defined(_MSC_VER) || (_MSC_VER > 1916)
409 template <
class T = TimeZonePtr,
410 class =
typename std::enable_if
422 template <
class Duration2,
class TimeZonePtr2,
423 class =
typename std::enable_if
425 std::is_convertible<sys_time<Duration2>,
430 template <
class Duration2,
class TimeZonePtr2,
431 class =
typename std::enable_if
433 std::is_convertible<sys_time<Duration2>,
440 template <
class T = TimeZonePtr,
441 class =
typename std::enable_if
443 std::is_constructible
452 template <
class T = TimeZonePtr,
453 class =
typename std::enable_if
455 std::is_constructible
464 template <
class T = TimeZonePtr,
465 class =
typename std::enable_if
467 std::is_constructible
477 template <
class Duration2,
class TimeZonePtr2,
class T = TimeZonePtr,
478 class =
typename std::enable_if
480 std::is_convertible<sys_time<Duration2>,
482 std::is_constructible
491 template <
class Duration2,
class TimeZonePtr2,
class T = TimeZonePtr,
492 class =
typename std::enable_if
494 std::is_convertible<sys_time<Duration2>,
496 std::is_constructible
508#if !defined(_MSC_VER) || (_MSC_VER > 1916)
509 template <
class T = TimeZonePtr,
510 class =
typename std::enable_if
512 std::is_constructible
522#if !defined(_MSC_VER) || (_MSC_VER > 1916)
523 template <
class T = TimeZonePtr,
524 class =
typename std::enable_if
526 std::is_constructible
536#if !defined(_MSC_VER) || (_MSC_VER > 1916)
537 template <
class T = TimeZonePtr,
538 class =
typename std::enable_if
540 std::is_constructible
550#if !defined(_MSC_VER) || (_MSC_VER > 1916)
551 template <
class T = TimeZonePtr,
552 class =
typename std::enable_if
554 std::is_constructible
564#if !defined(_MSC_VER) || (_MSC_VER > 1916)
565 template <
class T = TimeZonePtr,
566 class =
typename std::enable_if
568 std::is_constructible
579#if !defined(_MSC_VER) || (_MSC_VER > 1916)
580 template <
class T = TimeZonePtr,
581 class =
typename std::enable_if
583 std::is_constructible
594#if !defined(_MSC_VER) || (_MSC_VER > 1916)
595 template <
class Duration2,
class TimeZonePtr2,
class T = TimeZonePtr,
596 class =
typename std::enable_if
598 std::is_convertible<sys_time<Duration2>,
600 std::is_constructible
608 template <class Duration2, class TimeZonePtr2>
612#if !defined(_MSC_VER) || (_MSC_VER > 1916)
613 template <
class Duration2,
class TimeZonePtr2,
class T = TimeZonePtr,
614 class =
typename std::enable_if
616 std::is_convertible<sys_time<Duration2>,
618 std::is_constructible
626 template <class Duration2, class TimeZonePtr2>
630#if !defined(_MSC_VER) || (_MSC_VER > 1916)
631 template <
class Duration2,
class TimeZonePtr2,
class T = TimeZonePtr,
632 class =
typename std::enable_if
634 std::is_convertible<sys_time<Duration2>,
636 std::is_constructible
645 template <class Duration2, class TimeZonePtr2>
650#if !defined(_MSC_VER) || (_MSC_VER > 1916)
651 template <
class Duration2,
class TimeZonePtr2,
class T = TimeZonePtr,
652 class =
typename std::enable_if
654 std::is_convertible<sys_time<Duration2>,
656 std::is_constructible
665 template <class Duration2, class TimeZonePtr2>
683 template <
class Duration1,
class Duration2,
class TimeZonePtr1>
689 template <
class CharT,
class Traits,
class Duration1,
class TimeZonePtr1>
691 std::basic_ostream<CharT, Traits>&
692 operator<<(std::basic_ostream<CharT, Traits>& os,
698 template <
class TimeZonePtr2>
701 check(TimeZonePtr2&& p);
706#if HAS_DEDUCTION_GUIDES
710 template<
typename TimeZonePtrOrName>
711 using time_zone_representation =
714 std::is_convertible<TimeZonePtrOrName, std::string_view>::value,
716 std::remove_cv_t<std::remove_reference_t<TimeZonePtrOrName>>
721 -> zoned_time<std::chrono::seconds>;
723template <
class Duration>
724zoned_time(sys_time<Duration>)
725 -> zoned_time<std::common_type_t<Duration, std::chrono::seconds>>;
727template <
class TimeZonePtrOrName>
728zoned_time(TimeZonePtrOrName&&)
729 -> zoned_time<std::chrono::seconds, detail::time_zone_representation<TimeZonePtrOrName>>;
731template <
class TimeZonePtrOrName,
class Duration>
732zoned_time(TimeZonePtrOrName&&, sys_time<Duration>)
733 -> zoned_time<std::common_type_t<Duration, std::chrono::seconds>, detail::time_zone_representation<TimeZonePtrOrName>>;
735template <
class TimeZonePtrOrName,
class Duration>
737 -> zoned_time<std::common_type_t<Duration, std::chrono::seconds>, detail::time_zone_representation<TimeZonePtrOrName>>;
739template <
class Duration,
class TimeZonePtrOrName,
class TimeZonePtr2>
741 -> zoned_time<std::common_type_t<Duration, std::chrono::seconds>, detail::time_zone_representation<TimeZonePtrOrName>>;
745template <
class Duration1,
class Duration2,
class TimeZonePtr>
754template <
class Duration1,
class Duration2,
class TimeZonePtr>
763#if !defined(_MSC_VER) || (_MSC_VER >= 1900)
769 struct expanded_ttinfo;
783 std::vector<detail::transition> transitions_;
784 std::vector<detail::expanded_ttinfo> ttinfos_;
791#if !defined(_MSC_VER) || (_MSC_VER >= 1900)
806 template <class Duration>
807 sys_time<typename std::common_type<Duration, std::chrono::seconds>::type>
810 template <class Duration>
811 sys_time<typename std::common_type<Duration, std::chrono::seconds>::type>
814 template <class Duration>
815 local_time<typename std::common_type<Duration, std::chrono::seconds>::type>
830 template <
class Duration>
833 template <
class Duration>
841 load_sys_info(std::vector<detail::transition>::const_iterator i)
const;
843 template <
class TimeType>
845 load_data(std::istream& inf, std::int32_t tzh_leapcnt, std::int32_t tzh_timecnt,
846 std::int32_t tzh_typecnt, std::int32_t tzh_charcnt);
854#if defined(_MSC_VER) && (_MSC_VER < 1900)
858 : name_(std::move(src.name_))
859 , zonelets_(std::move(src.zonelets_))
860 , adjusted_(std::move(src.adjusted_))
867 name_ = std::move(src.name_);
882template <
class Duration>
890template <
class Duration>
898template <
class Duration>
906template <
class Duration>
914template <
class Duration>
921 return LT{(tp + i.offset).time_since_epoch()};
932template <
class Duration>
933sys_time<typename std::common_type<Duration, std::chrono::seconds>::type>
949template <
class Duration>
1006 template <
class Duration>
1011 return x.
date_ == y;
1014 template <
class Duration>
1022 template <
class Duration>
1038template <
class Duration>
1046template <
class Duration>
1054template <
class Duration>
1062template <
class Duration>
1070template <
class Duration>
1078template <
class Duration>
1086template <
class Duration>
1094template <
class Duration>
1102template <
class Duration>
1134struct timezone_mapping
1136 timezone_mapping(
const char* other,
const char* territory,
const char* type)
1137 : other(other), territory(territory), type(type)
1140 timezone_mapping() =
default;
1142 std::string territory;
1162 std::vector<detail::timezone_mapping> mappings;
1167#if !defined(_MSC_VER) || (_MSC_VER >= 1900)
1177 , mappings(std::move(src.mappings))
1182 version = std::move(src.version);
1183 zones = std::move(src.zones);
1184 links = std::move(src.links);
1186 rules = std::move(src.rules);
1187 mappings = std::move(src.mappings);
1219 class const_iterator;
1229 struct undocumented_helper;
1257 {
return x.p_ == y.p_;}
1326template <
class Po
inter>
1337template <
class Duration,
class TimeZonePtr>
1338template <
class TimeZonePtr2>
1344 throw std::runtime_error(
1345 "zoned_time constructed with a time zone pointer == nullptr");
1346 return std::forward<TimeZonePtr2>(p);
1349template <
class Duration,
class TimeZonePtr>
1350#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1351template <
class T,
class>
1355 : zone_(check(
zoned_traits<TimeZonePtr>::default_zone()))
1358template <
class Duration,
class TimeZonePtr>
1359#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1360template <
class T,
class>
1364 : zone_(check(
zoned_traits<TimeZonePtr>::default_zone()))
1368template <
class Duration,
class TimeZonePtr>
1371 : zone_(check(std::move(z)))
1376template <
class Duration,
class TimeZonePtr>
1377template <
class T,
class>
1385template <
class Duration,
class TimeZonePtr>
1386#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1387template <
class T,
class>
1396template <
class Duration,
class TimeZonePtr>
1397template <
class Duration2,
class>
1404template <
class Duration,
class TimeZonePtr>
1407 : zone_(check(std::move(z)))
1411template <
class Duration,
class TimeZonePtr>
1412#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1413template <
class T,
class>
1417 : zone_(check(std::move(z)))
1418 , tp_(zone_->to_sys(t))
1421template <
class Duration,
class TimeZonePtr>
1422#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1423template <
class T,
class>
1428 : zone_(check(std::move(z)))
1429 , tp_(zone_->to_sys(t, c))
1432template <
class Duration,
class TimeZonePtr>
1433template <
class Duration2,
class TimeZonePtr2,
class>
1437 : zone_(check(std::move(z)))
1441template <
class Duration,
class TimeZonePtr>
1442template <
class Duration2,
class TimeZonePtr2,
class>
1451template <
class Duration,
class TimeZonePtr>
1452template <
class T,
class>
1459template <
class Duration,
class TimeZonePtr>
1460template <
class T,
class>
1467template <
class Duration,
class TimeZonePtr>
1468template <
class T,
class>
1475template <
class Duration,
class TimeZonePtr>
1476template <
class Duration2,
class TimeZonePtr2,
class,
class>
1479 const zoned_time<Duration2, TimeZonePtr2>& zt)
1483template <
class Duration,
class TimeZonePtr>
1484template <
class Duration2,
class TimeZonePtr2,
class,
class>
1487 const zoned_time<Duration2, TimeZonePtr2>& zt,
1494template <
class Duration,
class TimeZonePtr>
1495#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1496template <
class T,
class>
1504template <
class Duration,
class TimeZonePtr>
1505#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1506template <
class T,
class>
1514template <
class Duration,
class TimeZonePtr>
1515#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1516template <
class T,
class>
1524template <
class Duration,
class TimeZonePtr>
1525#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1526template <
class T,
class>
1534template <
class Duration,
class TimeZonePtr>
1535#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1536template <
class T,
class>
1544template <
class Duration,
class TimeZonePtr>
1545#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1546template <
class T,
class>
1554template <
class Duration,
class TimeZonePtr>
1555#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1556template <
class Duration2,
class TimeZonePtr2,
class,
class>
1558template <
class Duration2,
class TimeZonePtr2>
1566template <
class Duration,
class TimeZonePtr>
1567#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1568template <
class Duration2,
class TimeZonePtr2,
class,
class>
1570template <
class Duration2,
class TimeZonePtr2>
1578template <
class Duration,
class TimeZonePtr>
1579#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1580template <
class Duration2,
class TimeZonePtr2,
class,
class>
1582template <
class Duration2,
class TimeZonePtr2>
1591template <
class Duration,
class TimeZonePtr>
1592#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1593template <
class Duration2,
class TimeZonePtr2,
class,
class>
1595template <
class Duration2,
class TimeZonePtr2>
1606template <
class Duration,
class TimeZonePtr>
1615template <
class Duration,
class TimeZonePtr>
1620 tp_ = zone_->to_sys(ut);
1624template <
class Duration,
class TimeZonePtr>
1628 return get_local_time();
1631template <
class Duration,
class TimeZonePtr>
1633zoned_time<Duration, TimeZonePtr>::operator sys_time<typename zoned_time<Duration, TimeZonePtr>::duration>()
const
1635 return get_sys_time();
1638template <
class Duration,
class TimeZonePtr>
1646template <
class Duration,
class TimeZonePtr>
1651 return zone_->to_local(tp_);
1654template <
class Duration,
class TimeZonePtr>
1662template <
class Duration,
class TimeZonePtr>
1667 return zone_->get_info(tp_);
1679template <
class Duration>
1681zoned_time<typename std::common_type<Duration, std::chrono::seconds>::type>
1687template <
class TimeZonePtr
1688#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1689#if !defined(__INTEL_COMPILER) || (__INTEL_COMPILER > 1600)
1690 ,
class =
typename std::enable_if
1704zoned_time<std::chrono::seconds, TimeZonePtr>
1717template <
class Duration,
class TimeZonePtr
1718#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1719#if !defined(__INTEL_COMPILER) || (__INTEL_COMPILER > 1600)
1720 ,
class =
typename std::enable_if
1722 std::is_class<typename std::decay<decltype(*std::declval<TimeZonePtr&>())>::type>{}
1728zoned_time<typename std::common_type<Duration, std::chrono::seconds>::type, TimeZonePtr>
1732 TimeZonePtr>(std::move(zone), tp);
1735template <
class Duration,
class TimeZonePtr
1736#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1737#if !defined(__INTEL_COMPILER) || (__INTEL_COMPILER > 1600)
1738 ,
class =
typename std::enable_if
1740 std::is_class<typename std::decay<decltype(*std::declval<TimeZonePtr&>())>::type>{}
1746zoned_time<typename std::common_type<Duration, std::chrono::seconds>::type, TimeZonePtr>
1750 TimeZonePtr>(std::move(zone), tp, c);
1753template <
class Duration>
1755zoned_time<typename std::common_type<Duration, std::chrono::seconds>::type>
1758 return zoned_time<
typename std::common_type<Duration,
1759 std::chrono::seconds>::type>(
name, tp);
1762template <
class Duration>
1764zoned_time<typename std::common_type<Duration, std::chrono::seconds>::type>
1767 return zoned_time<
typename std::common_type<Duration,
1768 std::chrono::seconds>::type>(
name, tp, c);
1771template <
class Duration,
class TimeZonePtr>
1773zoned_time<Duration, TimeZonePtr>
1779template <
class Duration,
class TimeZonePtr>
1781zoned_time<Duration, TimeZonePtr>
1787template <
class Duration,
class TimeZonePtr>
1789zoned_time<Duration, TimeZonePtr>
1795template <
class Duration,
class TimeZonePtr>
1797zoned_time<Duration, TimeZonePtr>
1803template <
class Duration,
class TimeZonePtr
1804#if !defined(_MSC_VER) || (_MSC_VER > 1916)
1805#if !defined(__INTEL_COMPILER) || (__INTEL_COMPILER > 1600)
1806 ,
class =
typename std::enable_if
1808 std::is_class<typename std::decay<decltype(*std::declval<TimeZonePtr&>())>::type>{}
1814zoned_time<typename std::common_type<Duration, std::chrono::seconds>::type, TimeZonePtr>
1818 TimeZonePtr>(std::move(zone), st);
1821template <
class Duration>
1823zoned_time<typename std::common_type<Duration, std::chrono::seconds>::type>
1826 return zoned_time<
typename std::common_type<Duration,
1827 std::chrono::seconds>::type>(
name, st);
1830template <
class CharT,
class Traits,
class Duration,
class TimeZonePtr>
1831std::basic_ostream<CharT, Traits>&
1832to_stream(std::basic_ostream<CharT, Traits>& os,
const CharT* fmt,
1839 return to_stream(os, fmt, LT{(st+info.offset).time_since_epoch()},
1840 &info.abbrev, &info.offset);
1843template <
class CharT,
class Traits,
class Duration,
class TimeZonePtr>
1845std::basic_ostream<CharT, Traits>&
1846operator<<(std::basic_ostream<CharT, Traits>& os,
const zoned_time<Duration, TimeZonePtr>& t)
1848 const CharT fmt[] = {
'%',
'F',
' ',
'%',
'T',
' ',
'%',
'Z', CharT{}};
1863 template<
typename Duration>
1865 std::chrono::time_point<std::chrono::system_clock, typename std::common_type<Duration, std::chrono::seconds>::type>
1866 to_sys(
const std::chrono::time_point<utc_clock, Duration>&);
1868 template<
typename Duration>
1870 std::chrono::time_point<utc_clock, typename std::common_type<Duration, std::chrono::seconds>::type>
1871 from_sys(
const std::chrono::time_point<std::chrono::system_clock, Duration>&);
1873 template<
typename Duration>
1875 std::chrono::time_point<local_t, typename std::common_type<Duration, std::chrono::seconds>::type>
1876 to_local(
const std::chrono::time_point<utc_clock, Duration>&);
1878 template<
typename Duration>
1880 std::chrono::time_point<utc_clock, typename std::common_type<Duration, std::chrono::seconds>::type>
1884template <
class Duration>
1885 using utc_time = std::chrono::time_point<utc_clock, Duration>;
1889template <
class Duration>
1893 using std::chrono::seconds;
1894 using CD =
typename std::common_type<Duration, seconds>::type;
1896 auto const lt = std::upper_bound(leaps.begin(), leaps.end(), st);
1897 return utc_time<CD>{st.time_since_epoch() + seconds{lt-leaps.begin()}};
1903template <
class Duration>
1904std::pair<bool, std::chrono::seconds>
1907 using std::chrono::seconds;
1908 using duration =
typename std::common_type<Duration, seconds>::type;
1911 auto const lt = std::upper_bound(leaps.begin(), leaps.end(), tp);
1912 auto ds = seconds{lt-leaps.begin()};
1915 if (lt > leaps.begin())
1919 if (tp >= lt[-1].
date() - seconds{1})
1934template <
class Duration>
1939 return {p.first, p.second};
1942template <
class Duration>
1943sys_time<typename std::common_type<Duration, std::chrono::seconds>::type>
1946 using std::chrono::seconds;
1947 using CD =
typename std::common_type<Duration, seconds>::type;
1949 auto tp =
sys_time<CD>{ut.time_since_epoch() - ls.second};
1951 tp = floor<seconds>(tp) + seconds{1} - CD{1};
1959 return from_sys(std::chrono::system_clock::now());
1962template <
class Duration>
1969template <
class Duration>
1973 using CD =
typename std::common_type<Duration, std::chrono::seconds>::type;
1977template <
class CharT,
class Traits,
class Duration>
1978std::basic_ostream<CharT, Traits>&
1979to_stream(std::basic_ostream<CharT, Traits>& os,
const CharT* fmt,
1982 using std::chrono::seconds;
1983 using CT =
typename std::common_type<Duration, seconds>::type;
1984 const std::string abbrev(
"UTC");
1987 auto tp =
sys_time<CT>{t.time_since_epoch() - ls.second};
1988 auto const sd = floor<days>(tp);
1993 return to_stream(os, fmt, fds, &abbrev, &offset);
1996template <
class CharT,
class Traits,
class Duration>
1997std::basic_ostream<CharT, Traits>&
1998operator<<(std::basic_ostream<CharT, Traits>& os,
const utc_time<Duration>& t)
2000 const CharT fmt[] = {
'%',
'F',
' ',
'%',
'T', CharT{}};
2004template <
class Duration,
class CharT,
class Traits,
class Alloc = std::allocator<CharT>>
2005std::basic_istream<CharT, Traits>&
2008 std::chrono::minutes* offset =
nullptr)
2010 using std::chrono::seconds;
2011 using std::chrono::minutes;
2012 using CT =
typename std::common_type<Duration, seconds>::type;
2013 minutes offset_local{};
2014 auto offptr = offset ? offset : &offset_local;
2019 is.setstate(std::ios::failbit);
2022 bool is_60_sec = fds.tod.seconds() == seconds{60};
2028 if (is_60_sec !=
is_leap_second(tmp).first || !fds.tod.in_conventional_range())
2030 is.setstate(std::ios::failbit);
2033 tp = std::chrono::time_point_cast<Duration>(tmp);
2051 template<
typename Duration>
2053 std::chrono::time_point<utc_clock, typename std::common_type<Duration, std::chrono::seconds>::type>
2056 template<
typename Duration>
2058 std::chrono::time_point<tai_clock, typename std::common_type<Duration, std::chrono::seconds>::type>
2061 template<
typename Duration>
2063 std::chrono::time_point<local_t, typename std::common_type<Duration, date::days>::type>
2066 template<
typename Duration>
2068 std::chrono::time_point<tai_clock, typename std::common_type<Duration, date::days>::type>
2072template <
class Duration>
2073 using tai_time = std::chrono::time_point<tai_clock, Duration>;
2077template <
class Duration>
2082 using std::chrono::seconds;
2083 using CD =
typename std::common_type<Duration, seconds>::type;
2088template <
class Duration>
2093 using std::chrono::seconds;
2094 using CD =
typename std::common_type<Duration, seconds>::type;
2106template <
class Duration>
2111 using CD =
typename std::common_type<Duration, date::days>::type;
2116template <
class Duration>
2121 using CD =
typename std::common_type<Duration, date::days>::type;
2126template <
class CharT,
class Traits,
class Duration>
2127std::basic_ostream<CharT, Traits>&
2128to_stream(std::basic_ostream<CharT, Traits>& os,
const CharT* fmt,
2131 const std::string abbrev(
"TAI");
2132 CONSTDATA std::chrono::seconds offset{0};
2136template <
class CharT,
class Traits,
class Duration>
2137std::basic_ostream<CharT, Traits>&
2138operator<<(std::basic_ostream<CharT, Traits>& os,
const tai_time<Duration>& t)
2140 const CharT fmt[] = {
'%',
'F',
' ',
'%',
'T', CharT{}};
2144template <
class Duration,
class CharT,
class Traits,
class Alloc = std::allocator<CharT>>
2145std::basic_istream<CharT, Traits>&
2148 std::basic_string<CharT, Traits, Alloc>* abbrev =
nullptr,
2149 std::chrono::minutes* offset =
nullptr)
2171 template<
typename Duration>
2173 std::chrono::time_point<utc_clock, typename std::common_type<Duration, std::chrono::seconds>::type>
2176 template<
typename Duration>
2178 std::chrono::time_point<gps_clock, typename std::common_type<Duration, std::chrono::seconds>::type>
2181 template<
typename Duration>
2183 std::chrono::time_point<local_t, typename std::common_type<Duration, date::days>::type>
2186 template<
typename Duration>
2188 std::chrono::time_point<gps_clock, typename std::common_type<Duration, date::days>::type>
2192template <
class Duration>
2193 using gps_time = std::chrono::time_point<gps_clock, Duration>;
2197template <
class Duration>
2202 using std::chrono::seconds;
2203 using CD =
typename std::common_type<Duration, seconds>::type;
2209template <
class Duration>
2214 using std::chrono::seconds;
2215 using CD =
typename std::common_type<Duration, seconds>::type;
2228template <
class Duration>
2233 using CD =
typename std::common_type<Duration, date::days>::type;
2238template <
class Duration>
2243 using CD =
typename std::common_type<Duration, date::days>::type;
2249template <
class CharT,
class Traits,
class Duration>
2250std::basic_ostream<CharT, Traits>&
2251to_stream(std::basic_ostream<CharT, Traits>& os,
const CharT* fmt,
2254 const std::string abbrev(
"GPS");
2255 CONSTDATA std::chrono::seconds offset{0};
2259template <
class CharT,
class Traits,
class Duration>
2260std::basic_ostream<CharT, Traits>&
2261operator<<(std::basic_ostream<CharT, Traits>& os,
const gps_time<Duration>& t)
2263 const CharT fmt[] = {
'%',
'F',
' ',
'%',
'T', CharT{}};
2267template <
class Duration,
class CharT,
class Traits,
class Alloc = std::allocator<CharT>>
2268std::basic_istream<CharT, Traits>&
2271 std::basic_string<CharT, Traits, Alloc>* abbrev =
nullptr,
2272 std::chrono::minutes* offset =
nullptr)
2283template <
class DstClock,
class SrcClock>
2290 template <
class Duration>
2302 template <
class Duration>
2314 template <
class Duration>
2326 template <
class Duration>
2337 template <
class Duration>
2348 template <
class Duration>
2360 template <
class Duration>
2372 template <
class Duration>
2383 template <
class Duration>
2391template<
typename Clock>
2394 template <
class Duration>
2396 std::chrono::time_point<Clock, Duration>
2397 operator()(
const std::chrono::time_point<Clock, Duration>& tp)
const
2406template <
class Clock,
class Duration>
2410using std::chrono::system_clock;
2414template <
class Clock,
class TimePo
int>
2420 static_assert(std::is_same<TimePoint, clock_time_point>::value,
2421 "time point with appropariate clock shall be returned");
2426template <
class Clock,
class Duration,
class =
void>
2430template <
class Clock,
class Duration>
2434 decltype(Clock::to_sys(declval<time_point<Clock, Duration> const&>()), void())
2439 decltype(Clock::to_sys(declval<time_point<Clock, Duration> const&>()))
2444template <
class Clock,
class Duration,
class =
void>
2448template <
class Clock,
class Duration>
2452 decltype(Clock::from_sys(declval<time_point<system_clock, Duration> const&>()),
2458 decltype(Clock::from_sys(declval<time_point<system_clock, Duration> const&>()))
2463template <
class Clock,
class Duration,
class =
void>
2467template <
class Clock,
class Duration>
2471 decltype(Clock::to_utc(declval<time_point<Clock, Duration> const&>()), void())
2476 decltype(Clock::to_utc(declval<time_point<Clock, Duration> const&>()))>
2480template <
class Clock,
class Duration,
class =
void>
2484template <
class Clock,
class Duration>
2488 decltype(Clock::from_utc(declval<time_point<utc_clock, Duration> const&>()),
2494 decltype(Clock::from_utc(declval<time_point<utc_clock, Duration> const&>()))
2499template<
typename Clock,
typename Duration,
typename =
void>
2503template<
typename Clock,
typename Duration>
2507 decltype(Clock::to_local(declval<time_point<Clock, Duration> const&>()),
2513 decltype(Clock::to_local(declval<time_point<Clock, Duration> const&>()))
2518template<
typename Clock,
typename Duration,
typename =
void>
2522template<
typename Clock,
typename Duration>
2526 decltype(Clock::from_local(declval<time_point<local_t, Duration> const&>()),
2532 decltype(Clock::from_local(declval<time_point<local_t, Duration> const&>()))
2538template <
class SrcClock>
2541 template <
class Duration>
2544 operator()(
const std::chrono::time_point<SrcClock, Duration>& tp)
const
2546 return SrcClock::to_sys(tp);
2550template <
class DstClock>
2553 template <
class Duration>
2558 return DstClock::from_sys(st);
2562template <
class SrcClock>
2565 template <
class Duration>
2568 operator()(
const std::chrono::time_point<SrcClock, Duration>& tp)
const
2570 return SrcClock::to_utc(tp);
2574template <
class DstClock>
2577 template <
class Duration>
2582 return DstClock::from_utc(ut);
2586template<
typename SrcClock>
2589 template <
class Duration>
2592 operator()(
const std::chrono::time_point<SrcClock, Duration>& tp)
const
2594 return SrcClock::to_local(tp);
2598template<
typename DstClock>
2601 template <
class Duration>
2606 return DstClock::from_local(lt);
2610namespace clock_cast_detail
2613template <
class Clock,
class Duration>
2615using std::chrono::system_clock;
2617template <
class DstClock,
class SrcClock,
class Duration>
2621 ->
decltype(std::declval<clock_time_conversion<DstClock, SrcClock>>()(t))
2627template <
class DstClock,
class SrcClock,
class Duration>
2631 ->
decltype(conv_clock<DstClock>(t))
2633 return conv_clock<DstClock>(t);
2637template <
class DstClock,
class SrcClock,
class Duration>
2641 ->
decltype(conv_clock<DstClock>(conv_clock<system_clock>(t)))
2643 return conv_clock<DstClock>(conv_clock<system_clock>(t));
2647template <
class DstClock,
class SrcClock,
class Duration>
2650cc_impl(
const time_point<SrcClock, Duration>& t,
const void*)
2652 conv_clock<DstClock>(conv_clock<utc_clock>(t)))
2654 return conv_clock<DstClock>(conv_clock<utc_clock>(t));
2658template <
class DstClock,
class SrcClock,
class Duration>
2662 ->
decltype(conv_clock<DstClock>(conv_clock<utc_clock>(conv_clock<system_clock>(t))))
2664 return conv_clock<DstClock>(conv_clock<utc_clock>(conv_clock<system_clock>(t)));
2668template <
class DstClock,
class SrcClock,
class Duration>
2671cc_impl(
const time_point<SrcClock, Duration>& t, ...)
2673 conv_clock<DstClock>(conv_clock<system_clock>(conv_clock<utc_clock>(t))))
2675 return conv_clock<DstClock>(conv_clock<system_clock>(conv_clock<utc_clock>(t)));
2680template <
class DstClock,
class SrcClock,
class Duration>
2684 ->
decltype(clock_cast_detail::cc_impl<DstClock>(tp, &tp))
2686 return clock_cast_detail::cc_impl<DstClock>(tp, &tp);
2691template <
class Duration>
2693sys_time<typename std::common_type<Duration, std::chrono::seconds>::type>
2699template <
class Duration>
2701sys_time<typename std::common_type<Duration, std::chrono::seconds>::type>
2707template <
class Duration>
2709sys_time<typename std::common_type<Duration, std::chrono::seconds>::type>
2716template <
class Duration>
2718utc_time<typename std::common_type<Duration, std::chrono::seconds>::type>
2724template <
class Duration>
2726utc_time<typename std::common_type<Duration, std::chrono::seconds>::type>
2732template <
class Duration>
2734utc_time<typename std::common_type<Duration, std::chrono::seconds>::type>
2741template <
class Duration>
2743tai_time<typename std::common_type<Duration, std::chrono::seconds>::type>
2749template <
class Duration>
2751tai_time<typename std::common_type<Duration, std::chrono::seconds>::type>
2757template <
class Duration>
2759tai_time<typename std::common_type<Duration, std::chrono::seconds>::type>
2766template <
class Duration>
2768gps_time<typename std::common_type<Duration, std::chrono::seconds>::type>
2774template <
class Duration>
2776gps_time<typename std::common_type<Duration, std::chrono::seconds>::type>
2782template <
class Duration>
2784gps_time<typename std::common_type<Duration, std::chrono::seconds>::type>
ambiguous_local_time(local_time< Duration > tp, const local_info &i)
static std::string make_msg(local_time< Duration > tp, const local_info &i)
static std::chrono::time_point< local_t, typename std::common_type< Duration, date::days >::type > to_local(const std::chrono::time_point< gps_clock, Duration > &) NOEXCEPT
std::chrono::time_point< gps_clock > time_point
std::chrono::system_clock::duration duration
static std::chrono::time_point< utc_clock, typename std::common_type< Duration, std::chrono::seconds >::type > to_utc(const std::chrono::time_point< gps_clock, Duration > &) NOEXCEPT
static const bool is_steady
static std::chrono::time_point< gps_clock, typename std::common_type< Duration, std::chrono::seconds >::type > from_utc(const std::chrono::time_point< utc_clock, Duration > &) NOEXCEPT
static std::chrono::time_point< gps_clock, typename std::common_type< Duration, date::days >::type > from_local(const std::chrono::time_point< local_t, Duration > &) NOEXCEPT
friend DATE_API std::ostream & operator<<(std::ostream &os, const leap_second &x)
friend bool operator==(const leap_second &x, const leap_second &y)
friend bool operator==(const leap_second &x, const sys_time< Duration > &y)
friend bool operator<(const leap_second &x, const leap_second &y)
DATE_API leap_second(const std::string &s, detail::undocumented)
static std::string make_msg(local_time< Duration > tp, const local_info &i)
nonexistent_local_time(local_time< Duration > tp, const local_info &i)
static const bool is_steady
static std::chrono::time_point< local_t, typename std::common_type< Duration, date::days >::type > to_local(const std::chrono::time_point< tai_clock, Duration > &) NOEXCEPT
std::chrono::system_clock::duration duration
static std::chrono::time_point< tai_clock, typename std::common_type< Duration, date::days >::type > from_local(const std::chrono::time_point< local_t, Duration > &) NOEXCEPT
static std::chrono::time_point< utc_clock, typename std::common_type< Duration, std::chrono::seconds >::type > to_utc(const std::chrono::time_point< tai_clock, Duration > &) NOEXCEPT
static std::chrono::time_point< tai_clock, typename std::common_type< Duration, std::chrono::seconds >::type > from_utc(const std::chrono::time_point< utc_clock, Duration > &) NOEXCEPT
std::chrono::time_point< tai_clock > time_point
friend bool operator<(const time_zone_link &x, const time_zone_link &y)
const std::string & target() const
const std::string & name() const
friend bool operator==(const time_zone_link &x, const time_zone_link &y)
DATE_API time_zone_link(const std::string &s)
friend DATE_API std::ostream & operator<<(std::ostream &os, const time_zone_link &x)
sys_time< typename std::common_type< Duration, std::chrono::seconds >::type > to_sys_impl(local_time< Duration > tp, choose z, std::false_type) const
DATE_API void parse_info(std::istream &in)
std::unique_ptr< std::once_flag > adjusted_
const std::string & name() const NOEXCEPT
DATE_API void add(const std::string &s)
sys_time< typename std::common_type< Duration, std::chrono::seconds >::type > to_sys(local_time< Duration > tp) const
time_zone & operator=(time_zone &&)=default
DATE_API sys_info get_info_impl(sys_seconds tp) const
sys_info get_info(sys_time< Duration > st) const
DATE_API void adjust_infos(const std::vector< detail::Rule > &rules)
local_time< typename std::common_type< Duration, std::chrono::seconds >::type > to_local(sys_time< Duration > tp) const
std::vector< detail::zonelet > zonelets_
time_zone(time_zone &&)=default
const_iterator operator++(int) NOEXCEPT
reference operator*() const NOEXCEPT
std::forward_iterator_tag iterator_category
friend bool operator!=(const const_iterator &x, const const_iterator &y) NOEXCEPT
const_iterator & operator++() NOEXCEPT
std::ptrdiff_t difference_type
const_iterator(tzdb *p) NOEXCEPT
pointer operator->() const NOEXCEPT
friend bool operator==(const const_iterator &x, const const_iterator &y) NOEXCEPT
const_iterator cbegin() const NOEXCEPT
const_iterator cend() const NOEXCEPT
const_iterator erase_after(const_iterator p) NOEXCEPT
void push_front(tzdb *tzdb) NOEXCEPT
std::atomic< tzdb * > head_
const tzdb & front() const NOEXCEPT
const_iterator begin() const NOEXCEPT
const_iterator end() const NOEXCEPT
static std::chrono::time_point< std::chrono::system_clock, typename std::common_type< Duration, std::chrono::seconds >::type > to_sys(const std::chrono::time_point< utc_clock, Duration > &)
static CONSTDATA bool is_steady
static std::chrono::time_point< local_t, typename std::common_type< Duration, std::chrono::seconds >::type > to_local(const std::chrono::time_point< utc_clock, Duration > &)
static std::chrono::time_point< utc_clock, typename std::common_type< Duration, std::chrono::seconds >::type > from_local(const std::chrono::time_point< local_t, Duration > &)
static std::chrono::time_point< utc_clock, typename std::common_type< Duration, std::chrono::seconds >::type > from_sys(const std::chrono::time_point< std::chrono::system_clock, Duration > &)
std::chrono::time_point< utc_clock > time_point
std::chrono::system_clock::duration duration
zoned_time(const std::string &name)
zoned_time(const std::string &name, const local_time< Duration > &tp, choose c)
zoned_time(TimeZonePtr z, const local_time< Duration > &tp)
friend std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &os, const zoned_time< Duration1, TimeZonePtr1 > &t)
zoned_time(const std::string &name, const zoned_time< Duration2, TimeZonePtr2 > &zt, choose)
typename std::common_type< Duration, std::chrono::seconds >::type duration
friend bool operator==(const zoned_time< Duration1, TimeZonePtr1 > &x, const zoned_time< Duration2, TimeZonePtr1 > &y)
sys_time< duration > get_sys_time() const
zoned_time(const std::string &name, const zoned_time< Duration2, TimeZonePtr2 > &zt)
local_time< duration > get_local_time() const
zoned_time & operator=(const sys_time< Duration > &st)
zoned_time(const std::string &name, const local_time< Duration > &tp)
zoned_time(const char *name, const local_time< Duration > &tp, choose c)
static TimeZonePtr2 && check(TimeZonePtr2 &&p)
zoned_time(TimeZonePtr z, const local_time< Duration > &tp, choose c)
zoned_time(const char *name, const local_time< Duration > &tp)
zoned_time(const char *name, const zoned_time< Duration2, TimeZonePtr2 > &zt)
sys_info get_info() const
zoned_time(const std::string &name, const sys_time< Duration > &st)
zoned_time(const char *name, const sys_time< Duration > &st)
TimeZonePtr get_time_zone() const
zoned_time(const char *name, const zoned_time< Duration2, TimeZonePtr2 > &zt, choose)
void load_data(MemoryManager &_data, Settings &_option, Parser &_parser, string sFileName)
This function is a wrapper for the Datafile object. It will simply do the whole UI stuff and let the ...
std::chrono::time_point< Clock, Duration > time_point
CONSTCD14 auto conv_clock(const time_point< SrcClock, Duration > &t) -> decltype(std::declval< clock_time_conversion< DstClock, SrcClock > >()(t))
CONSTCD14 auto cc_impl(const time_point< SrcClock, Duration > &t, const time_point< SrcClock, Duration > *) -> decltype(conv_clock< DstClock >(t))
std::chrono::time_point< Clock, Duration > time_point
T * to_raw_pointer(T *p) NOEXCEPT
typename nodeduct< T >::type nodeduct_t
auto to_raw_pointer(Pointer p) NOEXCEPT -> decltype(detail::to_raw_pointer(p.operator->()))
CONSTCD11 bool operator>=(const day &x, const day &y) NOEXCEPT
DATE_API bool remote_download(const std::string &version, char *error_buffer=nullptr)
tzdb_list & get_tzdb_list()
local_time< std::chrono::seconds > local_seconds
std::chrono::time_point< gps_clock, Duration > gps_time
tai_time< std::chrono::seconds > tai_seconds
std::pair< bool, std::chrono::seconds > is_leap_second(date::utc_time< Duration > const &ut)
std::chrono::time_point< tai_clock, Duration > tai_time
gps_time< typename std::common_type< Duration, std::chrono::seconds >::type > to_gps_time(const sys_time< Duration > &t)
const tzdb & reload_tzdb()
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)
std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &os, const day &d)
leap_second_info get_leap_second_info(date::utc_time< Duration > const &ut)
local_time< days > local_days
DATE_API bool remote_install(const std::string &version)
zoned_time< std::chrono::seconds > make_zoned()
CONSTDATA date::month January
zoned_time< std::chrono::seconds > zoned_seconds
utc_time< std::chrono::seconds > utc_seconds
CONSTCD11 bool operator>(const day &x, const day &y) NOEXCEPT
CONSTCD11 bool operator==(const day &x, const day &y) NOEXCEPT
std::chrono::time_point< std::chrono::system_clock, Duration > sys_time
CONSTCD11 hh_mm_ss< std::chrono::duration< Rep, Period > > make_time(const std::chrono::duration< Rep, Period > &d)
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)
CONSTCD11 bool operator!=(const day &x, const day &y) NOEXCEPT
CONSTDATA date::weekday Sunday
const time_zone * locate_zone(const std::string &tz_name)
CONSTCD11 bool operator<=(const day &x, const day &y) NOEXCEPT
std::chrono::time_point< utc_clock, Duration > utc_time
CONSTCD14 auto clock_cast(const std::chrono::time_point< SrcClock, Duration > &tp) -> decltype(clock_cast_detail::cc_impl< DstClock >(tp, &tp))
DATE_API std::string remote_version()
CONSTCD11 bool operator<(const day &x, const day &y) NOEXCEPT
sys_time< typename std::common_type< Duration, std::chrono::seconds >::type > to_sys_time(const utc_time< Duration > &t)
tai_time< typename std::common_type< Duration, std::chrono::seconds >::type > to_tai_time(const sys_time< Duration > &t)
utc_time< typename std::common_type< Duration, std::chrono::seconds >::type > to_utc_time(const sys_time< Duration > &t)
void set_install(const std::string &s)
std::chrono::time_point< local_t, Duration > local_time
sys_time< std::chrono::seconds > sys_seconds
sys_time< days > sys_days
gps_time< std::chrono::seconds > gps_seconds
const time_zone * current_zone()
CONSTCD14 std::chrono::time_point< Clock, Duration > operator()(const std::chrono::time_point< Clock, Duration > &tp) const
CONSTCD14 ctc_detail::return_from_local< DstClock, Duration >::type operator()(const local_time< Duration > <) const
CONSTCD14 ctc_detail::return_from_sys< DstClock, Duration >::type operator()(const sys_time< Duration > &st) const
CONSTCD14 ctc_detail::return_from_utc< DstClock, Duration >::type operator()(const utc_time< Duration > &ut) const
CONSTCD14 ctc_detail::return_to_local< SrcClock, Duration >::type operator()(const std::chrono::time_point< SrcClock, Duration > &tp) const
CONSTCD14 local_time< Duration > operator()(const local_time< Duration > <) const
CONSTCD14 local_time< Duration > operator()(const sys_time< Duration > &st) const
local_time< typename std::common_type< Duration, std::chrono::seconds >::type > operator()(const utc_time< Duration > &ut) const
CONSTCD14 ctc_detail::return_to_sys< SrcClock, Duration >::type operator()(const std::chrono::time_point< SrcClock, Duration > &tp) const
CONSTCD14 sys_time< Duration > operator()(const local_time< Duration > <) const
CONSTCD14 sys_time< Duration > operator()(const sys_time< Duration > &st) const
sys_time< typename std::common_type< Duration, std::chrono::seconds >::type > operator()(const utc_time< Duration > &ut) const
CONSTCD14 ctc_detail::return_to_utc< SrcClock, Duration >::type operator()(const std::chrono::time_point< SrcClock, Duration > &tp) const
utc_time< typename std::common_type< Duration, std::chrono::seconds >::type > operator()(const local_time< Duration > <) const
utc_time< typename std::common_type< Duration, std::chrono::seconds >::type > operator()(const sys_time< Duration > &st) const
CONSTCD14 utc_time< Duration > operator()(const utc_time< Duration > &ut) const
time_point< Clock, typename TimePoint::duration > clock_time_point
std::chrono::seconds elapsed
enum date::local_info::@25 result
std::chrono::minutes save
std::chrono::seconds offset
tzdb & operator=(tzdb &&)=default
std::vector< time_zone > zones
std::vector< time_zone_link > links
std::vector< detail::Rule > rules
std::vector< leap_second > leap_seconds
const time_zone * locate_zone(const std::string &tz_name) const
const time_zone * current_zone() const
static const time_zone * locate_zone(const std::string &name)
static const time_zone * default_zone()
static const time_zone * locate_zone(const char *name)
This structure defines the information for a time zone.