Rev 9260 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9260 | Rev 9765 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include "stddef.h" |
1 | #include "stddef.h" |
2 | #include |
2 | #include |
- | 3 | #include |
|
3 | #include |
4 | #include |
4 | #include |
5 | #include |
5 | #include |
- | |
Line 6... | Line 6... | ||
6 | 6 | ||
7 | const char *wday_str[7]={"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}; |
7 | const char* wday_str[7] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" }; |
Line 8... | Line 8... | ||
8 | const char *mon_str[12]={"Jan", "Feb", "Mar", "Ap", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; |
8 | const char* mon_str[12] = { "Jan", "Feb", "Mar", "Ap", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; |
9 | 9 | ||
Line 10... | Line 10... | ||
10 | #pragma GCC push_options |
10 | #pragma GCC push_options |
Line 11... | Line 11... | ||
11 | #pragma GCC optimize("O0") |
11 | #pragma GCC optimize("O0") |
- | 12 | ||
12 | 13 | #define TIME_STR_MAX 27 |
|
13 | #define TIME_STR_MAX 27 |
14 | |
14 | 15 | char* asctime(const struct tm* tm) |
|
15 | char *asctime(const struct tm *tm){ |
16 | { |
16 | if(!tm){ |
17 | if (!tm) { |
17 | errno = EINVAL; |
18 | __errno = EINVAL; |
18 | return NULL; |
19 | return NULL; |
Line 25... | Line 26... | ||
25 | snprintf(time_str, TIME_STR_MAX-1, "%.3s %.3s%3d %02d:%02d:%02d %d\n", |
26 | snprintf(time_str, TIME_STR_MAX - 1, "%.3s %.3s%3d %02d:%02d:%02d %d\n", |
26 | wday_str[tm->tm_wday], |
27 | wday_str[tm->tm_wday], |
27 | mon_str[tm->tm_mon], |
28 | mon_str[tm->tm_mon], |
28 | tm->tm_mday, tm->tm_hour, |
29 | tm->tm_mday, tm->tm_hour, |
29 | tm->tm_min, tm->tm_sec, |
30 | tm->tm_min, tm->tm_sec, |
30 | 1900 + tm->tm_year |
31 | 1900 + tm->tm_year); |
31 | ); |
- | |
32 | return time_str; |
32 | return time_str; |
33 | } |
33 | } |
34 | #pragma GCC pop_options0>0> |
34 | #pragma GCC pop_options>> |