[libcxx-commits] [PATCH] D154865: [libc++][format] Fixes times before epoch.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 18 08:31:13 PDT 2023


Mordante added inline comments.


================
Comment at: libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp:53
+
+  check(SV("1425-08-04 22:06:56"), SV("{}"), file_seconds(-17'179'869'184s)); // 35 bit minimum
+  check(SV("1901-12-13 20:45:52"), SV("{}"), file_seconds(-2'147'483'648s));
----------------
h-vetinari wrote:
> Mordante wrote:
> > @h-vetinari you mean here? This should be 35. I probably should add a link to http://eel.is/c++draft/time.syn.
> > ```
> >   // convenience typedefs
> >   using nanoseconds  = duration<signed integer type of at least 64 bits, nano>;
> >   using microseconds = duration<signed integer type of at least 55 bits, micro>;
> >   using milliseconds = duration<signed integer type of at least 45 bits, milli>;
> >   using seconds      = duration<signed integer type of at least 35 bits>;
> >   using minutes      = duration<signed integer type of at least 29 bits, ratio<  60>>;
> >   using hours        = duration<signed integer type of at least 23 bits, ratio<3600>>;
> > ```
> My mistake, sorry. I thought 32 vs. 35 might be a numpad-off-by-one-row error. "35 bit minimum" sounded like "smallest/oldest representable", but from the standard you cited it, it's not the minimum as in representable time, but the minimum as in "we need at least 35 bits"...
> 
> Sorry for the noise.
No problem, I appreciate your feedback!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154865/new/

https://reviews.llvm.org/D154865



More information about the libcxx-commits mailing list