Commit Graph
86 Commits
Author SHA1 Message Date
Howard Hinnant 07ada69385 Expose a list<TZ_DB>
* Existing API always accesses the front of the list.
* Add locate_zone and current_zone member functions to TZ_DB.
* reload_tzdb() pushes a new database to the front of the list.
* get_tzdb_list() exposes the list<TZ_DB>&.
2017-08-12 17:41:55 -04:00
Howard Hinnant c8d3cc14da Add zoned_time deduction guides 2017-07-06 20:49:53 -04:00
Howard Hinnant 2d1d8f2255 Put %Z back into default streaming for zoned_time
* It was removed by accident.
2017-07-01 23:00:34 -04:00
Howard Hinnant 56cec17500 Add gratuitous zoned_time:: qualifier to operators
*  VS-2017 compatibility.
2017-06-26 21:33:34 -04:00
Howard Hinnant d359399090 Give zoned_time a default constructor 2017-06-26 21:19:29 -04:00
Howard Hinnant a003ad28fa Make wide string literals in to_stream 2017-06-17 13:18:40 -04:00
Howard Hinnant 012f2c6135 Make to_stream and from_stream return a stream reference 2017-06-17 13:11:39 -04:00
Howard Hinnant edcd9bd9c1 define MISSING_LEAP_SECONDS 0 when !USE_OS_TZDB 2017-06-16 15:55:43 -04:00
Howard Hinnant 1139c9b64f Allow zoned_time with coarser precision than seconds
*  This gives greater interoperability with the deduction for class
   templates language feature.

*  time_points output from zoned_time still have at least seconds
   precision.
2017-06-13 23:00:54 -04:00
Howard Hinnant a610f087c1 Add support for the zic-compiled OS-supplied time zone DB:
*  Avoids the need to download the IANA database.

*  Heavily based on contributions by Aaron Bishop.

*  Turn on with -DUSE_OS_TZDB, off by default.

*  Not supported on Windows.

*  Disables HAS_REMOTE_API.

*  get_tzdb().version only supported on Apple.  This string has
   the value "unknown" elsewhere.

*  Leap second support is missing on Apple, and may not be on your
   platform either (please report).  Leap second support is enabled,
   disabled with -DMISSING_LEAP_SECONDS.

   Without leap second support, utc_time, tai_time, and gps_time (and
   those clocks) are not available.

*  On Apple, time zone transitions are only supported in the range:

   1901-12-13 20:45:52 to 2038-01-19 03:14:07

*  On Linux, time zone transitions are only as far in the future as
   the OS-provided transitions go.  There is no support for POSIX-
   style transitions.
2017-06-04 21:04:53 -04:00
Howard Hinnant 5132385454 Remove obsolete LAZY_INIT flag. 2017-06-04 20:32:37 -04:00
Howard Hinnant 5c38ad84e8 Eliminate TIMEZONE_MAPPING by making it equivalent to _WIN32.
*  Clean up indenting and whitespace.
*  No functionality changes intended.
2017-06-04 20:32:37 -04:00
Tullio Menga 83c8b4d522 changes for compatibility with Clang with Microsoft CodeGen (v140_clang_c2):
- added date:: namespace to flloor() and abs() calls
- added IUnknown forward declaration before including Windows headers to prevent issue with objbase.h
- minor changes
2017-05-08 10:04:20 -04:00
Howard Hinnant c64d69b1e1 Avoid getting localized time zone names from Windows OS.
* Use GetDynamicTimeZoneInformation to get .TimeZoneKeyName
  https://msdn.microsoft.com/en-us/library/windows/desktop/ms724318(v=vs.85).aspx
  > Retrieves the current time zone and dynamic daylight saving time settings.
  https://msdn.microsoft.com/en-us/library/windows/desktop/ms724253(v=vs.85).aspx
  > The name of the time zone registry key on the local computer.

* This avoids the need to map from StandardName to TimeZoneKeyName.

* Using .DynamicDaylightTimeDisabled = true forces the OS to return a
  non-daylight saving time result.

* Use of wcstombs is preferred over wstring_convert as the latter is now
  deprecated in C++17 because the implementors could not interpret the
  specification.
2017-04-17 19:06:58 -04:00
Howard Hinnant fc3d4d97fe Silence unused variable 'leaps' warning 2017-04-13 12:44:21 -04:00
Howard Hinnant 4f27361378 Add range checking for the time-of-day fields during parse.
*  Also refactor the leap-second logic used in utc_time.
2017-04-07 18:52:09 -04:00
Jan Kratochvil 1fd0806757 Fix -Wshadow for gcc and clang. 2017-04-03 20:46:36 -04:00
Howard Hinnant 3ab6510cab Update copyright to 2017 2017-03-21 21:52:51 -04:00
Howard Hinnant 9e1120c676 Make time_of_day default constructor non-explicit.
Add zoned_time const char* overloaded constructor.
2017-03-12 15:18:53 -04:00
gaspardpetit f4292e6aca Added Alloc argument to template parameters to support custom allocators in from_stream 2017-03-11 20:13:06 -05:00
Gaspard Petit a811a20748 Fixes minor typos in comments - no actual change to code 2017-03-08 11:28:35 -05:00
Howard Hinnant 3df43424ac Add from_stream 2017-03-02 13:16:22 -10:00
Howard Hinnant 1e7e7a214d Simplify the implementation of format and parse:
* For format, all a type must do is implement to_stream.

* For parse, each type X must specialize parse_manip<X,CharT,Traits>.
  Each specialization must include a public typedef to itself named
  type.

* Each parse_manip specialization must have a stream extraction
  operator.

* This commit depends on expression-SFINAE.  If this commit breaks
  your build, it is likely that your compiler/version does not
  support expression-SFINAE.  To fix this NO_EXPRESSION_SFINAE
  needs to be defined in the configuration area of date.h for
  that compiler/version.
2017-02-26 14:10:10 -05:00
Howard Hinnant ffc8cd0a3b Add format and parse to tai_time, gps_time, year_month_day 2017-02-26 09:28:15 -05:00
Howard Hinnant e9d36c6200 Rewrite format and parse in terms of detail::fields<Duration>
* Add format and parse to utc_time<Duration>.
* Added more tests.
2017-02-25 20:44:59 -05:00
Howard Hinnant 5c09ae73f2 Work around {} bug for older compilers 2017-02-08 11:32:33 -05:00
Jiangang (Jeff) Zhuang ea1717e8ab Define DATE_API empty when building static lib on Windows 2017-01-10 20:31:32 -05:00
Howard Hinnant 634b84eb60 Introduce set_install as suggested by PR 99
* Retain install variable as a function local static to maintain
  recent fixes to initialization order problems.
2017-01-07 18:27:40 -05:00
Howard Hinnant e203304afd Give DATE_API a default definition. 2017-01-05 20:24:46 -05:00
Jiangang (Jeff) Zhuang 4e44539a59 export symbols on Windows 2017-01-04 20:48:34 -05:00
Howard Hinnant 298e9aff2d Add to_stream which avoids temporary streams and strings.
*  This is a low-level formatting facility which other functions
   such as format call into.
2016-11-25 20:37:51 -05:00
Howard Hinnant 887d7574b1 Default USE_SHELL_API to 1 2016-10-23 18:58:00 -04:00
Howard Hinnant 806c29fddc Lots of minor changes motivated by reviews of the draft proposal 2016-10-15 17:31:08 -04:00
Howard Hinnant 501609bacf Make those time_point conversions which can be noexcept, noexcept 2016-10-12 19:48:45 -04:00
Howard Hinnant fab89b205b Minor cleanups in the clocks 2016-10-09 20:11:11 -04:00
Howard Hinnant 81b5cc65f0 Remove static conversion functions from clocks
The free function converters are sufficient API.
2016-10-08 16:05:10 -04:00
Sascha Zelzer 641cd739c3 VS2013's std::vector does not support incomplete template types.
This commit works around this by exposing the zonelet class declaration
to the public tz.h header.
2016-09-15 20:10:04 -04:00
Sascha Zelzer 570a1e699c Do not use user defined literals for VS2013 compatibility. 2016-09-15 20:10:04 -04:00
Sascha Zelzer e107bcdef2 Use NOEXCEPT macro for VS2013 compatibility. 2016-09-15 20:10:04 -04:00
Howard Hinnant 3e25bd45f7 Clean up includes
Alphabetize and survey for missing and unneeded includes.
2016-08-27 14:18:46 -04:00
Howard Hinnant ebc20c139b Move formatting and parsing
Moved formatting and parsing of sys_time and local_time from tz.h to
date.h in order to make this functionality available to a wider
audience.  Existing code does not need to change.  But future code
can #include "date.h" instead of "tz.h" and need not compile tz.cpp nor
link to curl.

Formatting zoned_time remains in tz.h.
2016-08-24 20:54:24 -04:00
Howard Hinnant 952857e721 Correct type-o in error message 2016-08-14 20:35:22 -04:00
Howard Hinnant 0663b7aeb3 Allow only one decimal point to be read under "%Ez". 2016-08-09 23:23:55 -04:00
Howard Hinnant 77435397cb Handle fractional seconds and offsets better. 2016-08-08 18:25:17 -04:00
Pavel 52e2a0b2cf Prevent warnings when using -Wundef flag 2016-07-04 11:14:59 -04:00
Howard Hinnant 7331f36318 Enable the converting constructor to actually work. 2016-06-27 22:23:58 -04:00
Howard Hinnant 33cdfc6485 Fix bug in formatting zoned_times produced by ambiguous local times. 2016-06-24 20:33:40 -04:00
Howard Hinnant ffb876afa6 Fix bug in format 2016-06-17 20:39:07 -04:00
gm 55087c6cbd HAS_REMOTE_API support for Windows. Adds support for MingW too.
* HAS_REMOTE_API still defaults to 0
* When HAS_REMOTE_API=0 only libraries advapi32.lib, ole32.lib and shell32.lib are required.
* Setting HAS_REMOTE_API=1 requires curl: https://curl.haxx.se/libcurl/
*- Also need to manually install 7-Zip (http://www.7-zip.org).
*- Will automatically install Tinyxml2 (http://www.grinninglizard.com/tinyxml2/).
*- Will automatically install http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml
2016-06-16 22:03:12 -04:00
Howard Hinnant b38d20e126 Replace some chrono literals for C++11 compatibility. 2016-06-09 22:02:26 -04:00