Skip to content

Commit 05305e2

Browse files
cfriedtkartben
authored andcommitted
lib: libc: common: time: do not set errno in time()
The ISO C function time() is not specified to set the global errno variable, so remove that in case there are side-effects. Signed-off-by: Chris Friedt <[email protected]>
1 parent 54e16c4 commit 05305e2

File tree

1 file changed

+0
-2
lines changed
  • lib/libc/common/source/time

1 file changed

+0
-2
lines changed

lib/libc/common/source/time/time.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* SPDX-License-Identifier: Apache-2.0
66
*/
77

8-
#include <errno.h>
98
#include <time.h>
109

1110
#include <zephyr/sys/clock.h>
@@ -17,7 +16,6 @@ time_t time(time_t *tloc)
1716

1817
ret = sys_clock_gettime(SYS_CLOCK_REALTIME, &ts);
1918
if (ret < 0) {
20-
errno = -ret;
2119
return (time_t) -1;
2220
}
2321

0 commit comments

Comments
 (0)