mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-16 03:19:54 +08:00
d482870337
* libc/include/time.h (time): Add restrict keyword. * libc/include/wchar.h (wcsftime): Add restrict keyword. * libc/time/asctime_r.c (asctime_r): Same. * libc/time/gmtime_r.c (gmtime_r): Same. * libc/time/lcltime_r.c (lcltime_r): Same. * libc/time/strftime.c (strftime): Same. * libc/time/strptime.c (strptime): Same. * libc/sys/linux/linuxthreads/timer_create.c (timer_create): Same. * libc/sys/linux/linuxthreads/timer_settime.c (timer_settime): Same.
28 lines
633 B
C
28 lines
633 B
C
/*
|
|
* asctime_r.c
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
|
|
char *
|
|
_DEFUN (asctime_r, (tim_p, result),
|
|
_CONST struct tm *__restrict tim_p _AND
|
|
char *__restrict result)
|
|
{
|
|
static _CONST char day_name[7][3] = {
|
|
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
|
};
|
|
static _CONST char mon_name[12][3] = {
|
|
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
|
};
|
|
|
|
siprintf (result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
|
|
day_name[tim_p->tm_wday],
|
|
mon_name[tim_p->tm_mon],
|
|
tim_p->tm_mday, tim_p->tm_hour, tim_p->tm_min,
|
|
tim_p->tm_sec, 1900 + tim_p->tm_year);
|
|
return result;
|
|
}
|