-
Notifications
You must be signed in to change notification settings - Fork 7.4k
libc/minimal: add support for gmtime and its reverse "timegm" #17468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Found the following issues, please fix and resubmit: License issuesIn most cases you do not need to do anything here, especially if the files
|
I've updated the code so the words "public domain" are in a separate comment from the one that provides the proper
|
Provide definitions for a subset of the standard time types that must be provided by this file, in anticipation of supporting civil time in Zephyr. Signed-off-by: Peter A. Bigot <[email protected]>
Implement the conversion from UNIX time to broken-down civil time per the gmtime() and gmtime_r() functions. Signed-off-by: Peter A. Bigot <[email protected]>
Add a generic API to provide the inverse operation for gmtime and as a home for future generic time-related functions that are not in POSIX. Signed-off-by: Peter A. Bigot <[email protected]>
This verifies gmtime and timeutil_timegm against each other and reference data for a wide range of instances. Signed-off-by: Peter A. Bigot <[email protected]>
I've decoupled this from the POSIX subsystem, hopefully reducing any impediments to it being processed towards a merge. There's nothing I can do about the license check failure, which seems to be based on the words "public domain" appearing in the file outside the license block. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for refactoring. (Can't vouch that there's nothing to improve here or something won't need a change later, but definitely looks good for the initial in, and surely useful).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good and addresses all the discussion points that we have raised priorly
This PR replaces #17003, using the standard name
gmtime
for conversion betweenstruct tm
andtime_t
. Thegmtime
function is added to minimal libc, and a sys library supporting time-related operations is added for the reverse function compatible with the GLIBCtimegm
extension.This adds the POSIX
gmtime_r
instead of the Cgmtime_s
because the former is more common and, in fact, is currently used in stm32 drivers.