llvm-project/libc/include
Raman Tenneti 6f0f844e9a Initial commit of mktime.
This introduces mktime to LLVM libc, based on C99/C2X/Single Unix Spec.

Co-authored-by: Jeff Bailey <jeffbailey@google.com>

This change doesn't handle TIMEZONE,  tm_isdst and leap seconds.  It returns -1 for invalid dates. I have verified the return results for all the possible dates with glibc's mktime.

TODO:
+ Handle leap seconds.
+ Handle out of range time and date values that don't overflow or underflow.
+ Implement the following suggestion Siva - As we start accumulating the seconds, we should be able to check if the next amount of seconds to be added can lead to an overflow. If it does, return the overflow value.  If not keep accumulating. The benefit is that, we don't have to validate every input, and also do not need the special cases for sizeof(time_t) == 4.
+ Handle timezone and update of tm_isdst

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D91551
2020-11-30 21:07:16 -08:00
..
sys [libc][NFC] Make all top of file comments consistent. 2020-04-08 10:18:37 -07:00
CMakeLists.txt Initial commit of mktime. 2020-11-30 21:07:16 -08:00
__llvm-libc-common.h [libc][NFC] Make all top of file comments consistent. 2020-04-08 10:18:37 -07:00
__llvm-libc-stdc-types.h [libc] Add definitions of double_t and float_t to math.h. 2020-04-30 11:59:11 -07:00
__posix-types.h [libc] Add write(2) implementation for Linux and FDReader test utility 2020-04-17 13:21:05 -04:00
assert.h.def [libc][NFC] Make all top of file comments consistent. 2020-04-08 10:18:37 -07:00
ctype.h.def [libc] Add scaffolding for ctype and implementation of isalpha 2020-07-28 19:17:31 -04:00
errno.h.def [libc][NFC] Make all top of file comments consistent. 2020-04-08 10:18:37 -07:00
math.h.def [libc][NFC] Make all top of file comments consistent. 2020-04-08 10:18:37 -07:00
signal.h.def [libc][NFC] Make all top of file comments consistent. 2020-04-08 10:18:37 -07:00
stdio.h.def [libc] Add very basic stdio FILE and fwrite 2020-04-14 04:02:27 -04:00
stdlib.h.def [libc][NFC] Make all top of file comments consistent. 2020-04-08 10:18:37 -07:00
string.h.def [libc][NFC] Make all top of file comments consistent. 2020-04-08 10:18:37 -07:00
threads.h.def [libc][NFC] Make all top of file comments consistent. 2020-04-08 10:18:37 -07:00
time.h.def Initial commit of mktime. 2020-11-30 21:07:16 -08:00
unistd.h.def [libc] Add write(2) implementation for Linux and FDReader test utility 2020-04-17 13:21:05 -04:00