Tomasz Kamiński
b87eb970c1
Implemented test for checking addition with classes converible to years/months
...
To work this specific test require current implementation
strategy (template with unspecified argument).
2019-09-03 22:52:31 -04:00
Paul Dreik
6f0b645df1
#388 add comment on unit test failure ( #442 )
2019-07-21 20:47:33 -04:00
tomaszkam
e31daf8093
Unit tests for !year_month::ok() arithmetic. ( #425 )
2019-03-19 20:22:23 -04:00
Howard Hinnant
b5d025ea2f
Align time_of_day with hh_mm_ss
...
Per committee review
2019-03-19 19:50:30 -04:00
Howard Hinnant
5a62c405e0
Remove unneeded make_precision
2019-02-03 23:21:36 -05:00
Howard Hinnant
9cb0013aef
Update time_of_day to be more consistent ...
...
the needs of formatting.
2019-02-02 14:06:12 -05:00
Howard Hinnant
6a4d93a0bd
Silence more shadow warnings
2018-07-01 23:00:33 -04:00
tomaszkam
f46885e632
Suffix d for days duration ( #354 )
2018-06-20 11:39:48 -04:00
Tomasz Kamiński
2d282e35fa
Use string_literal for C++11 when possible
2018-06-19 19:37:02 -04:00
Howard Hinnant
40b83654b6
[API BREAKING] Remove conversion from weekday to unsigned
...
* There has been a great deal of anguish over the encoding of
weekdays: whether [0, 6] maps to [Sunday, Saturday] or
[1, 7] maps to [Monday, Sunday]. This commit attempts
to address that issue, but will break a small amount of
code at compile-time. See below on how to fix that.
* The weekday constructor used to accept [0, 6] to represent
[Sunday, Saturday]. It now accepts [0, 7] to represent
[Sunday, Saturday] with both 0 and 7 mapping to Sunday.
* The conversion from weekday to unsigned has been removed.
* To convert a weekday to unsigned replace:
auto u = unsigned{wd};
with:
auto u = (wd - Sunday).count();
This maps [Sunday, Saturday] to [0, 6], which is the
C/POSIX mapping. If you prefer the ISO mapping
([Monday, Sunday] -> [1, 7]), then do:
auto u = (wd - Monday).count() + 1;
2018-06-02 22:56:10 -04:00
Tomasz Kamiński
328cecaa56
Fixed addition of multi-year duration to year_month.
...
* Added new overloads for operator+/- between year_month and duration
that is convertible to years, so it is better candidate for operands
that are convertible to both years and months. To preserve
functionality, this operator is conditionally noexcept.
* Reworked year_month_day, year_month_day_last, year_month_weekday,
and year_month_weekday_last.
* Added tests for this new functionality.
2018-05-12 18:21:24 -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
43d8a4eab0
Range check minutes under parse
2018-03-02 09:03:41 -05:00
Howard Hinnant
481771ef5e
Add support down to femtosecond precision
...
* Requires platform specific use of 128bit integral representation
(e.g. std::chrono::duration<__int128_t, std::femto>).
2017-09-09 10:30:39 -04:00
Howard Hinnant
9c181a1440
Update tests for default constructible:
...
* weekday_indexed
* year_month_weekday
2017-08-05 16:31:18 -04:00
Howard Hinnant
aa4dafcc46
Silence sign conversion warnings
2017-06-12 13:33:47 -04:00
Howard Hinnant
0fb3921e5b
Fail if you need a valid year and don't parse one.
2017-05-20 23:04:49 -04:00
Howard Hinnant
f493bd67f2
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:07 -04:00
Howard Hinnant
cf0481b9af
Reset command, width and modified for %n and %t in from_stream.
2017-05-04 21:03:48 -04:00
Howard Hinnant
2f8997d3ed
Make parse fail if fmt string is not completely consumed.
2017-04-18 12:02:21 -04:00
Howard Hinnant
3495c513a1
Enable parse and format for more types:
...
* year
* month
* day
* weekday
* year_month
* month_day
2017-03-25 17:46:17 -04:00
Howard Hinnant
d110f07f59
Clean up time_of_day tests.
...
* Don't assume int64_t is the rep in the predefined chrono durations.
2017-03-14 11:05:33 -04: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
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
628404b87c
Re-implement parse.
...
* Work with const CharT* format at the lowest level.
* Avoid dependence on std::lib except for locale-sensitive parsing.
* Add tests for parse.
2016-12-26 16:27:56 -05:00
Howard Hinnant
8a3aeb566b
Fix and test format %y
2016-11-27 15:30:01 -05:00
Howard Hinnant
a5450e9d02
Fix and test format %C
2016-11-27 13:41:24 -05:00
Howard Hinnant
2310435582
Add a format test stressing range
2016-11-26 16:15:08 -05:00
Howard Hinnant
3fb4d32922
Update tests for default constructible calendar types
2016-09-15 20:21:56 -04:00
Howard Hinnant
6fe8b4b7f3
Update copyright to 2016
2016-05-30 22:21:08 -04:00
Howard Hinnant
ea2d0d3357
constexpr more stuff and clean up whitespace
2016-05-30 22:09:21 -04:00
Howard Hinnant
76c906d779
Get off of day_point
2016-05-21 10:24:25 -04:00
Howard Hinnant
47cf8a7d42
Silence warning
2015-12-05 19:13:18 -05:00
Howard Hinnant
c8ee261043
Added a few convenience field getters:
...
* year_month_weekday::weekday()
* year_month_weekday::index()
* year_month_weekday_last::weekday()
2015-09-19 13:46:09 -04:00
Howard Hinnant
68f7d11c45
Add sizeof test
2015-09-06 16:58:22 -04:00
Howard Hinnant
a0d2343eab
Try disabling construction of weekday from int.
...
Also fix bug in round for negatives.
2015-09-02 20:48:44 -04:00
Howard Hinnant
9b79ad2ce2
Add tests for time_of_day and make_time
2015-08-15 14:21:43 -04:00
Howard Hinnant
2841bc69a7
Exhaustive survey test for op div
2015-08-15 12:33:10 -04:00
Howard Hinnant
12e6d38bba
Add tests for operator/()
2015-08-14 19:17:12 -04:00
Howard Hinnant
27ebc9dc44
Add tests for year_month_weekday_last
2015-08-14 16:55:06 -04:00
Howard Hinnant
6e347c11e9
Add tests for year_month_weekday
2015-08-14 16:47:11 -04:00
Howard Hinnant
5f182bc410
Add tests for year_month_day_last
2015-08-14 16:26:42 -04:00
Howard Hinnant
cb3ffd10e0
Add tests for year
2015-08-14 13:57:45 -04:00
Howard Hinnant
751f6aa279
Extra sanity checks for year_month_day
2015-08-10 23:09:56 -04:00
Howard Hinnant
e95858bb7d
Add tests for year_month_day
2015-08-09 22:18:31 -04:00
Howard Hinnant
7796894a1c
Add tests for year_month
2015-08-09 17:37:33 -04:00
Howard Hinnant
c8f5ec5b4d
Add tests for month_weekday_last
2015-08-09 16:31:12 -04:00
Howard Hinnant
71d54735b5
Add tests for month_weekday
2015-08-09 15:55:48 -04:00
Howard Hinnant
6ef4eac56e
Add test for month_day_last
2015-08-09 15:41:55 -04:00
Howard Hinnant
6e0ce6aafe
Add test for month_day
2015-08-09 15:34:50 -04:00