1 /* 2 * Copyright (c) 2024 Meta Platforms 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #undef _POSIX_C_SOURCE 8 #define _POSIX_C_SOURCE 200809L 9 #include <time.h> 10 11 /** 12 * `ctime()` is equivalent to `asctime(localtime(clock))` 13 * See: https://pubs.opengroup.org/onlinepubs/009695399/functions/ctime.html 14 */ 15 ctime(const time_t * clock)16char *ctime(const time_t *clock) 17 { 18 return asctime(localtime(clock)); 19 } 20 21 #if defined(CONFIG_COMMON_LIBC_CTIME_R) ctime_r(const time_t * clock,char * buf)22char *ctime_r(const time_t *clock, char *buf) 23 { 24 struct tm tmp; 25 26 return asctime_r(localtime_r(clock, &tmp), buf); 27 } 28 #endif /* CONFIG_COMMON_LIBC_CTIME_R */ 29