Last change
on this file since 444 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
600 bytes
|
Rev | Line | |
---|
[444] | 1 | /* |
---|
| 2 | * asctime_r.c |
---|
| 3 | */ |
---|
| 4 | |
---|
| 5 | #include <stdio.h> |
---|
| 6 | #include <time.h> |
---|
| 7 | |
---|
| 8 | char * |
---|
| 9 | asctime_r (const struct tm *__restrict tim_p, |
---|
| 10 | char *__restrict result) |
---|
| 11 | { |
---|
| 12 | static const char day_name[7][3] = { |
---|
| 13 | "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" |
---|
| 14 | }; |
---|
| 15 | static const char mon_name[12][3] = { |
---|
| 16 | "Jan", "Feb", "Mar", "Apr", "May", "Jun", |
---|
| 17 | "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" |
---|
| 18 | }; |
---|
| 19 | |
---|
| 20 | siprintf (result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n", |
---|
| 21 | day_name[tim_p->tm_wday], |
---|
| 22 | mon_name[tim_p->tm_mon], |
---|
| 23 | tim_p->tm_mday, tim_p->tm_hour, tim_p->tm_min, |
---|
| 24 | tim_p->tm_sec, 1900 + tim_p->tm_year); |
---|
| 25 | return result; |
---|
| 26 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.