-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
localtime() is referenced by do_fstat(), which is always (indirectly) referenced by the startup code. Having ctime defined in the same file will also always pull in asctime & strftime.
- Loading branch information
Showing
3 changed files
with
23 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "private.h" | ||
|
||
/* | ||
** 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)) | ||
*/ | ||
char *ctime(const time_t *timep) | ||
{ | ||
struct tm *tmp = localtime(timep); | ||
|
||
return tmp ? asctime(tmp) : NULL; | ||
} | ||
|
||
char *ctime_r(const time_t *timep, char *buf) | ||
{ | ||
struct tm mytm; | ||
struct tm *tmp = localtime_r(timep, &mytm); | ||
|
||
return tmp ? asctime_r(tmp, buf) : NULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters