[libc-commits] [PATCH] D91551: Initial commit of mktime.
Jeff Bailey via Phabricator via libc-commits
libc-commits at lists.llvm.org
Tue Dec 1 11:03:13 PST 2020
jeffbailey added inline comments.
================
Comment at: libc/config/linux/api.td:41
+ let Decl = [{
+ typedef long time_t;
+ }];
----------------
MaskRay wrote:
> This may not be a good declaration for 32-bit systems (their support may have lower priority, though, I guess). https://sourceware.org/glibc/wiki/Y2038ProofnessDesign
>
> Then you can avoid all the `sizeof(time_t) == 4` special cases.
The declaration of time_t comes from the following:
The range and precision of times representable in clock_t and time_t are
implementation-defined. (C99 7.23.1(4))
time_t shall be an integer type. (https://pubs.opengroup.org/onlinepubs/9699919799/toc.htm)
IBM has an analysis: https://www.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.ref.dev.doc/q104610_.htm
In practice, it will be somewhat more nuanced because of backwards compatibility. I expect that *historical* 32-bit systems will need to maintain a 32-bit signed time_t for compat. However, *new* ones (like em32_t) would use a 64-bit time_t. Since this libc doesn't any support for that we've used this. Someone implementing em32_t would have to go over I think many such types, so I'm not worried about this being extra work for them later if/when that happens.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91551/new/
https://reviews.llvm.org/D91551
More information about the libc-commits
mailing list