41 Commits
Author SHA1 Message Date
Andrea Pappacoda 8eeae97520 Support dark color-scheme
This patch updates the html documentation to add the color-scheme meta
element, signaling ligth and dark color scheme support, and updating the
inline CSS styles to override some colors when dark mode is active, to
make sure that the document is always readable.

I've also cleaned up a bit the CSS styles, but without functional
changes.
2024-09-28 16:39:58 -04:00
Howard Hinnant 84b983a15e Update weekday spec with:
* c_encoding
    * iso_encoding
2023-05-29 11:04:21 -04:00
Howard Hinnant dad52961da Remove extra '}'
Fixes #8
2019-12-31 17:05:33 -05:00
F d90045212d Better explain that from_stream does not change the value of the target (#389)
in case of an error and that !ok() is not an indication of error.

Fixes issue #387.
2018-09-26 17:13:58 -04:00
Howard Hinnant 0543e00b88 Clarify that year represents the proleptic Gregorian calendar
* Uses year{0} and negative years as opposed to AD/BC.
2018-06-03 14:03:29 -04:00
Howard Hinnant 4358ea7b6e [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:55:35 -04:00
Howard Hinnant dc217667ef Change names of weekdays and months:
* sun to Sunday, etc.
2018-06-02 22:04:02 -04:00
Howard Hinnant e5ac158f0f Make the parsing of minutes optional under the flags %z 2018-03-03 11:56:22 -05:00
Howard Hinnant e30c3f24b8 Add missing constexpr in many places 2018-01-07 14:19:36 -05:00
Howard Hinnant d6ae81acb3 Correct "double %Ez" type-o, two places. 2017-12-04 10:11:28 -05:00
Howard Hinnant 739dd1ee51 Replace undefined behavior with unspecified behavior
In the following places:

*  In [time.calendar]
*  In date.html
2017-11-03 13:18:51 -04:00
Howard Hinnant b3a55312ce Update links to new directory structure 2017-10-16 09:00:40 -04:00
Howard Hinnant 3370dab0ed to_stream sets failbit if required to supply a bad name:
* for an invalid month
* for an invalid weekday
2017-10-15 13:55:01 -04:00
Howard Hinnant 78c120f74a Have format set exceptions(failbit | badbit)
*  Be sure if something bad happens under the hood it is not silently
   swallowed.
2017-10-14 20:44:16 -04:00
Howard Hinnant 1e664d221f Correct some html 2017-09-30 16:13:06 -04:00
Howard Hinnant d404599ff5 Introduce the ONLY_C_LOCALE
*Eliminates dependance on on the time_get and time_put facets.
2017-08-18 22:57:29 -04:00
Howard Hinnant b639ed5332 Hard code year::min(), year::max() to [-32767, 32767]
* When year < 0, -year > 0 (always).
* These are the minimal limits C places on short.
* Reserving -32768 is useful in the implementation.
2017-08-15 12:40:03 -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 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 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 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 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 ae68278245 Add unary operators + and - to year 2016-10-19 12:01:51 -04:00
Howard Hinnant bcdf8acb8b Add trivial default constructors to most calendar types 2016-09-13 20:15:24 -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
Howard Hinnant 48d61f2631 Add type diagrams. 2016-06-27 22:36:48 -04:00
Howard Hinnant d3eb177cdc 'Update' copyright. 2016-06-09 22:28:52 -04:00
Howard Hinnant b3b39b0ae6 Support wide streams 2016-05-29 00:15:20 -04:00
Howard Hinnant c005648049 Fix type-o's 2016-05-28 14:10:30 -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
Howard Hinnant e3387fc21d misc cleanup 2016-05-07 16:29:13 -04:00
Howard Hinnant 2f020e2654 Added local_time, and renamed day_point to sys_days 2016-05-07 16:05:21 -04:00
Howard Hinnant 105bd7df89 Initial commit 2016-05-04 20:43:02 -04:00