tst_wcsftime.c 465 B

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