104 Commits

Author SHA1 Message Date
Howard Hinnant
0f7fd4a04e Remove errant -> from zoned_time(const time_zone* z) spec 2017-07-07 10:10:05 -04:00
Howard Hinnant
4477981840 Update revision history 2017-07-06 21:08:31 -04:00
Howard Hinnant
161cc2b7fe Add deduction guides to zoned_time
* Encourage seconds precision or finer.
2017-07-06 21:05:19 -04:00
Howard Hinnant
9264a21e1e Update Windows build instructions:
*  DATE_BUILD_LIB
*  NOMINMAX
2017-07-03 16:58:33 -04:00
Howard Hinnant
d5951c5476 Pass string_view by value 2017-06-30 12:02:30 -04:00
Howard Hinnant
2b100280c0 Improve spec for year_month - year_month 2017-06-29 21:33:43 -04:00
Howard Hinnant
2b55bdb2e4 Rewrite in terms of string_view 2017-06-29 21:19:50 -04:00
Howard Hinnant
cd888b2928 Tighten up year_month_weekday and year_month_weekday_last:
* conversions to sys_days.
2017-06-29 21:06:53 -04:00
Howard Hinnant
609dd49934 Add zoned_time default constructor and,
refine conversion from calendar types to sys_days and local_days.
2017-06-27 22:15:45 -04:00
Howard Hinnant
241551dd6c Allow day overflow in year_month_day to sys_days conversion 2017-06-27 14:08:02 -04:00
Howard Hinnant
8591ae062c Tighten up year spec:
* Define exactly how leap years are computed to avoid ambiguity.

* Define precise values for year::min and year::max which correspond
  to the C minimal limits for short.

* Rewrite year::ok() in terms of min and max.
2017-06-27 13:40:38 -04:00
Howard Hinnant
9a7b301507 Give zoned_time a default constructor 2017-06-26 21:19:09 -04:00
Howard Hinnant
b8c749227a Added issue concerning zoned_time default constructor. 2017-06-19 20:36:41 -04:00
Howard Hinnant
0f4737aeaa Initial commit of d0355r4.html 2017-06-19 20:32:31 -04:00
Howard Hinnant
047da3548e Change constraint on format functions
* For the two format functions dependent upon Alloc, constrain against
  basic_ostringstream<charT, traits, Alloc> instead of
  basic_ostream<charT, traits>.
2017-06-18 12:16:27 -04:00
Howard Hinnant
ddfaabea00 Reordered template parameter list in several places
* Make consistent with function argument list order.
2017-06-18 12:10:12 -04:00
Howard Hinnant
f8f2c9db10 Add paragraph to [time.parse] concerning failbit
*  The entire format string must be parsed, else failbit gets set.
2017-06-18 11:55:34 -04:00
Howard Hinnant
ed91190978 Refer to ios_base::failbit, not failbit 2017-06-18 11:49:25 -04:00
Howard Hinnant
f62ab2a2e0 Make constexpr literals inline
* Consistent with P0607R0.
2017-06-18 11:43:53 -04:00
Howard Hinnant
6fcb43311f Remove spurious 'class' from operator<< in many places. 2017-06-18 11:32:42 -04:00
Howard Hinnant
5d53bd2244 Fix missing template parameters in zoned_time operator<< 2017-06-18 11:28:09 -04:00
Howard Hinnant
60127222cd Remove spurious Duration template parameter
* From to_stream and from_stream.
* This was just a copy/paste error.
2017-06-18 11:16:48 -04:00
Howard Hinnant
59d8931136 Correct the return type of to_file_time(const sys_time<Duration>& t)
* The mapping between sys_time and file_time can occur at precisions
  coarser than a second because the only anticipated difference
  between these clocks is the epoch, and not the inclusion of leap
  seconds.
2017-06-18 10:53:45 -04:00
Howard Hinnant
e7dd17e572 Remove noexcept from to_file_time 2017-06-17 14:44:28 -04:00
Howard Hinnant
a83b047ef9 Make file_clock::now() noexcept 2017-06-17 13:30:36 -04:00
Howard Hinnant
a6c4c17e9a Remove noexcept from to_XXX_time conversion functions
* The Duration copy might throw.
2017-06-17 13:28:43 -04:00
Howard Hinnant
4f24af489c Make wide string literals in to_stream 2017-06-17 13:22:49 -04:00
Howard Hinnant
87620f4d1f Make to_stream and from_stream return a stream reference 2017-06-17 13:12:27 -04:00
Howard Hinnant
8b51803d7b Minor cleanup in is_clock 2017-06-17 10:34:54 -04:00
Howard Hinnant
7ffdc2450a Reword is_clock and add is_clock_v 2017-06-17 10:28:00 -04:00
Howard Hinnant
8c34cf1e8f Add link to reference 1 2017-06-17 00:00:03 -04:00
Howard Hinnant
5bc5a7f0bb Fill out link specification 2017-06-16 21:58:58 -04:00
Howard Hinnant
34e83bcf84 Fill out leaps specification 2017-06-16 21:47:54 -04:00
Howard Hinnant
09f16d53a2 Remove note in [thread.req.paramname] 2017-06-16 15:06:45 -04:00
Howard Hinnant
50c0111980 Improve wording in [thread.req.paramname] 2017-06-16 14:53:32 -04:00
Howard Hinnant
ff07f87b5b Run through spell checker 2017-06-16 13:35:13 -04:00
Howard Hinnant
27410b5095 Initial draft of D0355R3 2017-06-16 13:22:30 -04:00
Howard Hinnant
acf922d4ba Set failbit instead of throw within to_stream
* This is for consistency with other std streaming operations.
2017-06-12 21:03:01 -04:00
Howard Hinnant
e29fdf3374 Document USE_OS_TZDB. 2017-06-04 21:44:45 -04:00
Howard Hinnant
81b6367e98 Tweak white space parsing rules (again):
* White space matches zero or more white space characters.

  * %n matches one white space character.

  * %t matches zero or one white space characters.
2017-05-07 15:25:19 -04:00
Howard Hinnant
6618a2d3a7 Clarify how from_stream handles whitespace. 2017-05-04 16:32:22 -04:00
Howard Hinnant
b83f3412d0 Move chrono_io.h functionality into date.h. 2017-04-13 21:02:00 -04:00
Howard Hinnant
0dd1d499ae Restrict parse of %Z to valid timezone names and abbrev. 2017-04-13 14:23:42 -04:00
Howard Hinnant
ea8a24504d Do not change time_point of an invalid date is parsed. 2017-04-13 14:17:04 -04:00
Howard Hinnant
c036ef54bd Update %y documentation to specify implicit century. 2017-04-03 12:16:10 -04:00
Howard Hinnant
c10b729273 Rewrite of the to_stream/format/from_stream/parse docs:
* The bulk of the description is moved from tz.html to date.html.

* The format and parse flags are now described in detail, instead of
  implicitly relying on the C and POSIX specs.  This gives me room
  to specify a few corner cases that are either under-specified in
  the official specs, or to add extensions.

* The from_stream / to_stream specifications are now located with
  each specific type that implements them.  This allows more detailed
  documentation as to how each type interacts with the from_stream /
  to_stream system.

* The format and parse functions are now more clearly separated from
  to_stream and from_stream, and are documented to be nothing more
  than syntax sugar on top of any type that choses to implement
  to_stream or from_stream.
2017-04-01 22:48:54 -04:00
Howard Hinnant
82c6d6a3a4 Enable parse and format for more types:
* year
    * month
    * day
    * weekday
    * year_month
    * month_day
2017-03-25 17:45:39 -04:00
Howard Hinnant
f3b61aab48 Document set_install. 2017-03-22 22:52:07 -04:00
Howard Hinnant
c12319552a Add from_stream 2017-03-02 13:17:01 -10:00
Howard Hinnant
6466e58f94 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:25 -05:00
Howard Hinnant
5263c7b54c Add format and parse to tai_time, gps_time, year_month_day 2017-02-26 09:28:01 -05:00
Howard Hinnant
4f89141e56 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:45:16 -05:00
Howard Hinnant
fa86a381d1 Add format and parse overloads for durations 2017-01-28 16:21:42 -05:00
Howard Hinnant
e04ec9aa80 Fix type-o 2016-11-27 11:48:25 -05:00
Howard Hinnant
88f3c85517 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:35 -05:00
Howard Hinnant
5eb10b747f Unify and simplify fractional decimal seconds formatting
* Many of the ideas and some of the code herein is credited to
  Adrian Colomitchi

* Decouple fractional decimal seconds formatting from time_of_day
  formatting so that it can be more easily used elsewhere in the
  future.

* Include super-second durations such as nanocenturies and
  microfortnights in the class of durations that will get formatted
  with fractional decimal seconds.

* If a duration is exactly representable with fractional decimal
  seconds not exceeding 18 decimal fractional digits, format it
  exactly.  Otherwise format it to 6 fractional decimal digits
  (microseconds precision).  The number 18 is chosen as this is the
  limit of std::ratio using 64 bits (i.e. atto).

* The above bullet implies that durations with ratio<1, 4> will now
  be formatted with 2 fractional decimal digits instead of 1.
  ratio<1, 8> will be formatted with 3, and ratio<1, 3> with 6.

* Unify the implementation into one C++11 implementation that works
  equally well with C++14.

* Drive-by fix a couple formatting bugs dealing with negative
  durations.

* Deprecate the make_time functions taking unsigned md by removing
  their documentation.  Also deprecate the corresponding time_of_day
  constructors taking unsigned md.

* This change paves the way for future formatting improvements.
2016-11-24 19:54:20 -05:00
Howard Hinnant
d99e39f5d8 Default USE_SHELL_API to 1 2016-10-23 18:56:58 -04:00
Howard Hinnant
ae68278245 Add unary operators + and - to year 2016-10-19 12:01:51 -04:00
Howard Hinnant
769dc09f28 Minor polish 2016-10-16 23:13:36 -04:00
Howard Hinnant
41657bc50e Embellish issue 2. 2016-10-15 21:15:24 -04:00
Howard Hinnant
dd209e205e Add issues list to d0355r1 2016-10-15 21:02:01 -04:00
Howard Hinnant
5b2aa5f4be Lots of changes motivated by reviews 2016-10-15 17:32:14 -04:00
Howard Hinnant
b2b1d520c5 Make those time_point conversions which can be noexcept, noexcept 2016-10-12 19:48:07 -04:00
Howard Hinnant
2c16e09438 Replace CharT with charT and Traits with traits 2016-10-12 19:32:31 -04:00
Howard Hinnant
a7dd3132e0 Link R1 to Cppcon 2016 timezone presentation 2016-10-09 20:36:48 -04:00
Howard Hinnant
23ad937af0 Link to R0 2016-10-09 20:19:41 -04:00
Howard Hinnant
6133d1e636 Minor cleanups in the clocks 2016-10-09 20:13:02 -04:00
Howard Hinnant
176ffe7930 First commit of D0355R1 2016-10-09 20:12:32 -04:00
Howard Hinnant
026caba1c4 Remove static conversion functions from clocks
The free function converters are sufficient API.
2016-10-08 16:06:37 -04:00
Howard Hinnant
4aacc0b0b3 Add parse manipulators 2016-09-14 22:05:47 -04:00
Howard Hinnant
ddb826e490 format passes time_point by const& 2016-09-13 20:28:42 -04:00
Howard Hinnant
bcdf8acb8b Add trivial default constructors to most calendar types 2016-09-13 20:15:24 -04:00
Howard Hinnant
d7e38aa24f Add %F to parse 2016-09-09 21:07:05 -04:00
Howard Hinnant
47b51473c5 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:56:17 -04:00
schmidt9
e641f69667 iOS instructions added 2016-08-23 20:57:50 +03:00
Howard Hinnant
54a8b2dc19 Allow optional leading hours digit in offset when a colon is required. 2016-08-08 18:25:59 -04:00
Howard Hinnant
bddd8be2aa Document INSTALL, and reorganize Installation instructions. 2016-08-06 15:06:58 -04:00
Howard Hinnant
4e3a40a6dd Time something real. 2016-07-30 23:15:02 -04:00
Howard Hinnant
151d050391 Introduce chrono_io.h 2016-07-30 17:45:14 -04:00
Howard Hinnant
204a17cba8 Fix type-o. 2016-07-04 16:33:59 -04:00
Howard Hinnant
7de9902c60 Add Islamic calendar. 2016-07-04 16:32:31 -04:00
Howard Hinnant
48d61f2631 Add type diagrams. 2016-06-27 22:36:48 -04:00
Howard Hinnant
0fc9f3f879 Introduce julian.h 2016-06-26 18:49:51 -04:00
Howard Hinnant
d1f8e3ab7d Fix minor type-o 2016-06-17 20:39:52 -04:00
Howard Hinnant
9fb5e05eba 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:04:31 -04:00
Howard Hinnant
d3eb177cdc 'Update' copyright. 2016-06-09 22:28:52 -04:00
Howard Hinnant
49f4ef0a2c Add convenience converts among sys_time, utc_time, tai_time, and gps_time. 2016-06-08 20:49:03 -04:00
Howard Hinnant
58b08e0c74 Add tai_clock and gps_clock. 2016-06-07 22:47:42 -04:00
Howard Hinnant
1f5f4a0b62 Add streaming inserter for utc_time.
* Fix bug in utc_to_sys.
2016-06-06 21:06:25 -04:00
Howard Hinnant
c9c460f7b6 Create %Ez & %Oz to put ':' in offset for format and parse. 2016-06-01 23:25:22 -04:00
Howard Hinnant
0aeb2389ef Address review comments 2016-05-30 15:08:46 -04:00
Howard Hinnant
60bf737960 d0355r0 2016-05-29 18:36:44 -04:00
Howard Hinnant
b3b39b0ae6 Support wide streams 2016-05-29 00:15:20 -04:00
Howard Hinnant
1de4e4a150 Rename Leap to leap 2016-05-28 20:27:11 -04:00
Howard Hinnant
6102717e7f Rename Link to link 2016-05-28 20:21:17 -04:00
Howard Hinnant
c005648049 Fix type-o's 2016-05-28 14:10:30 -04:00
Howard Hinnant
6220fa83e4 Add more options to the parse functionality. 2016-05-22 12:28:26 -04:00
Howard Hinnant
52485c8403 Make construction from local_days explicit 2016-05-21 12:45:43 -04:00
Howard Hinnant
3758c23251 Continue bringing documentation up to date. 2016-05-21 10:15:58 -04:00
Howard Hinnant
89471a05c4 Continue bringing documentation up to date. 2016-05-15 22:48:52 -04:00