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