Commit Graph
23 Commits
Author SHA1 Message Date
Howard Hinnant b48a18a1d9 More fixes to allow duplicate parsing 2018-04-08 15:49:06 -04:00
Howard Hinnant cdb4b276d9 Allow duplicate parsing into the same fields
* as long as all duplicates produce consistent results.
2018-04-07 21:42:00 -04:00
Howard Hinnant 1d9e49ea21 to_stream sets failbit if unable to format
*  If a formatting flag requests data that is not available in
   the Streamable object, or if the Streamable object answers !ok(),
   failbit is set.
2018-04-06 11:19:44 -04:00
Howard Hinnant 0125d330ab Correct to_stream/from_stream handling of stream data
* to_stream and from_stream now reset the stream formatting state to
  default settings on entry, and restore the stream state on exit.

* to_stream and from_stream now correctly handle mis-modified flags.

* Fix %h to be equivalent to %b instead of %B.

* This addresses issues 319, 320 and 321.
2018-03-31 13:06:57 -04:00
Howard Hinnant 700489e475 Introduced full weekday and month names
* The standardized version of this library has std::chrono::January
  and std::chrono::Sunday in place of std::chrono_literals::jan and
  std::chrono_literals::sun.  Compatible names added to namespace
  date to ease transition from this lib to std::chrono.  The old
  names are retained for backwards compatibility.
2018-03-18 18:27:04 -04:00
Howard Hinnant 1e8ab50f82 Test modifications for standardization 2018-03-14 22:49:04 -04:00
Howard Hinnant 0bde4ba8c8 Make the parsing of minutes optional under the flag %z 2018-03-03 11:57:03 -05:00
Howard Hinnant 43d8a4eab0 Range check minutes under parse 2018-03-02 09:03:41 -05:00
mwu ca4036a4b0 Explicitly qualify std::string. Having a global scope string type shall not break the compilation anymore. 2018-02-23 21:17:26 -05:00
Scott Beil 2b6ee6378c minutes fix 2018-01-05 18:42:48 -05:00
Howard Hinnant b49bdc3ca7 Add missing include <memory> for unique_ptr 2017-12-06 10:12:49 -05:00
Howard Hinnant 443a29df53 Improve range check on year
* The previous fix broke parsing of sub-date quantities such as
  durations.
2017-11-30 12:06:51 -05:00
Howard Hinnant 1902b8e8fb Range check year on parse 2017-11-30 10:45:30 -05:00
Howard Hinnant c286981b3b Fix improper application of GCC diagnostic suppression 2017-11-21 10:07:31 -05:00
Howard Hinnant 9ca582d9da Silence GCC conversion warning for bitfields
* Used only in weekday_indexed.
2017-11-20 14:50:48 -05:00
Tullio Menga f4b12ab023 Adjust HAS_CHRONO_ROUNDING macro for MSVC with v140_clang_c2 and LLVM-vs2014 2017-11-20 11:45:04 -05:00
Howard Hinnant 4832ea0ddb Move HAS_STRING_VIEW to date.h 2017-11-17 11:09:17 -05:00
Tullio Menga ec514101a6 minor patches to build on Windows with MSVC v140_clang_c2 and LLVM-vs2014 2017-11-15 07:20:07 -05:00
Howard Hinnant 66a97f907e to_stream sets failbit if required to supply a bad name:
* for an invalid month
* for an invalid weekday
2017-10-15 13:57:19 -04:00
Howard Hinnant f328d8c84a Have format set exceptions(failbit | badbit)
*  Be sure if something bad happens under the hood it is not silently
   swallowed.
2017-10-14 20:42:26 -04:00
Manlio Morini 8b9f0515b5 Replacing 0 with nullptr to avoid GCC warning
All the calls to `std::time_get::get` had `0` as end-of-range iterator.

E.g.

    auto& f = use_facet<time_get<CharT>>(is.getloc());
	// ...
    f.get(is, 0, is, err, &tm, command, fmt+1);
              ^

Using `nullptr` instead of `0` doesn't trigger the GCC 5.x warning:

> warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]
2017-10-12 19:51:06 +02:00
Tomi Valkeinen 2032fccbb7 Fix valgrind warning about uninitialized variable use in to_stream()
tm variable is not initialized in to_stream(), and valgrind warns about
"Conditional jump or move depends on uninitialised value(s)".

This is a false positive, as strftime always reads tm_hour, even if it
ends up never using it. To silence the warnings, initialize tm to zero.
2017-10-03 15:22:49 -04:00
Markus Werle 3c3ba68906 Proposal for an alternative directory structure 2017-09-22 20:03:16 -04:00