mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-12 14:09:12 +00:00
Work towards improving signals and processes
This commit is contained in:
parent
de703b182c
commit
d7ac16a9ed
96 changed files with 1474 additions and 427 deletions
|
@ -20,4 +20,12 @@
|
|||
|
||||
static char g_asctime_buf[64];
|
||||
|
||||
char *asctime(const struct tm *date) { return asctime_r(date, g_asctime_buf); }
|
||||
/**
|
||||
* Converts date time to string.
|
||||
*
|
||||
* @return date time string in statically allocated buffer
|
||||
* @see asctime_r for reentrant version
|
||||
*/
|
||||
char *asctime(const struct tm *date) {
|
||||
return asctime_r(date, g_asctime_buf);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,13 @@ static unsigned clip(unsigned index, unsigned count) {
|
|||
return index < count ? index : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts date time to string.
|
||||
*
|
||||
* @param buf needs to have 64 bytes
|
||||
* @return pointer to buf
|
||||
* @see asctime_r for reentrant version
|
||||
*/
|
||||
char *asctime_r(const struct tm *date, char buf[hasatleast 64]) {
|
||||
(snprintf)(buf, 64, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
|
||||
kWeekdayNameShort[clip(date->tm_wday, 7)],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue