mktime incorrect on 2nd Jan 1970 #67101
Replies: 6 comments
-
It is out by an hour, so I assume that would be because of DST and this being a local timezone. |
Beta Was this translation helpful? Give feedback.
-
the structure is memset to 0 so DST is set to zero. It should be UTC as far as I'm aware. |
Beta Was this translation helpful? Give feedback.
-
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
Beta Was this translation helpful? Give feedback.
-
Why has this closed? |
Beta Was this translation helpful? Give feedback.
-
I don't think it's a newlib issue, looks like it's specific to native_posix target. @aescolar might have an idea |
Beta Was this translation helpful? Give feedback.
-
@matt-wood-ct please note that native_posix does not support NEWLIB (it only supports the host C library).
So you are building with and calling into the host C library native_sim can be used with embedded C libraries, but newlib does not come with source in the zephyr provided repos so that one is not an easy option. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
mktime
is returning an incorrect value for 2nd Jan 1970.While writing unit tests for a segment of code I found that mktime appears to incorrectly convert the date above into 82800 when the correct value is 86400, all my other test case values are working correctly it is only this low value that appears to fail for me.
I am running with NEWLIB LIB C enabled
To Reproduce
Steps to reproduce the behavior:
CONFIG_NEWLIB_LIBC=y
native_posix
time: 82800
Expected behavior
Output should be
time: 86400
Impact
Could affect behaviour of all projects utilising the standard time libraries.
Environment (please complete the following information):
Beta Was this translation helpful? Give feedback.
All reactions