llvm-project/libc
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
..
AOR_v20.02 Harmonize Python shebang 2020-07-16 21:53:45 +02:00
benchmarks Fix case mismatch between definition and declaration 2020-11-25 14:23:31 +00:00
cmake/modules [libc] Use entrypoints.txt as the single source of list of functions for a platform. 2020-10-15 20:46:13 +00:00
config Initial commit of mktime. 2020-11-30 21:07:16 -08:00
docs [libc] Add documentation for clang-tidy checks. 2020-07-06 18:15:35 -07:00
fuzzing [libc] Combine all math differential fuzzers into one target. 2020-11-20 07:46:15 -08:00
include Initial commit of mktime. 2020-11-30 21:07:16 -08:00
lib [libc] Add implementations of round and roundf. 2020-06-09 23:01:20 -07:00
loader [libc] Setup TLS in x86_64 loader. 2020-08-07 23:19:03 -07:00
spec Initial commit of mktime. 2020-11-30 21:07:16 -08:00
src Initial commit of mktime. 2020-11-30 21:07:16 -08:00
test Initial commit of mktime. 2020-11-30 21:07:16 -08:00
utils [libc] Fix typo in buildbot README.txt. 2020-11-27 19:01:21 +08:00
CMakeLists.txt [libc] Use entrypoints.txt as the single source of list of functions for a platform. 2020-10-15 20:46:13 +00:00
LICENSE.txt
README.txt

README.txt

LLVM libc
=========

This directory and its subdirectories contain source code for llvm-libc,
a retargetable implementation of the C standard library.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.