lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | #include <stdio.h> |
| 2 | #include <time.h> |
| 3 | #include <features.h> |
| 4 | #ifdef __UCLIBC_HAS_WCHAR__ |
| 5 | #include <wchar.h> |
| 6 | |
| 7 | int |
| 8 | main (int argc, char *argv[]) |
| 9 | { |
| 10 | wchar_t buf[200]; |
| 11 | time_t t; |
| 12 | struct tm *tp; |
| 13 | int result = 0; |
| 14 | size_t n; |
| 15 | |
| 16 | time (&t); |
| 17 | tp = gmtime (&t); |
| 18 | |
| 19 | n = wcsftime (buf, sizeof (buf) / sizeof (buf[0]), |
| 20 | L"%H:%M:%S %Y-%m-%d\n", tp); |
| 21 | if (n != 21) |
| 22 | result = 1; |
| 23 | |
| 24 | wprintf (L"It is now %ls", buf); |
| 25 | |
| 26 | wcsftime (buf, sizeof (buf) / sizeof (buf[0]), L"%A\n", tp); |
| 27 | |
| 28 | wprintf (L"The weekday is %ls", buf); |
| 29 | |
| 30 | return result; |
| 31 | } |
| 32 | |
| 33 | #else |
| 34 | int main(void) |
| 35 | { |
| 36 | puts("Test requires WCHAR support; skipping"); |
| 37 | return 0; |
| 38 | } |
| 39 | #endif |