2022-04-27 05:39:39 -07:00
|
|
|
#include "libc/calls/weirdtypes.h"
|
2022-08-13 17:20:50 -07:00
|
|
|
#include "libc/time/struct/tm.h"
|
2020-06-15 07:18:57 -07:00
|
|
|
#include "libc/time/time.h"
|
|
|
|
|
2023-10-02 19:25:19 -07:00
|
|
|
/**
|
|
|
|
* Represents time as string.
|
|
|
|
* @threadunsafe
|
|
|
|
*/
|
2022-04-27 05:39:39 -07:00
|
|
|
char *ctime(const time_t *timep) {
|
|
|
|
/*
|
|
|
|
** Section 4.12.3.2 of X3.159-1989 requires that
|
|
|
|
** The ctime function converts the calendar time pointed to by timer
|
|
|
|
** to local time in the form of a string. It is equivalent to
|
|
|
|
** asctime(localtime(timer))
|
|
|
|
*/
|
|
|
|
struct tm *tmp = localtime(timep);
|
|
|
|
return tmp ? asctime(tmp) : NULL;
|
|
|
|
}
|