Back to index

glibc  2.9
tst_wcsftime.c
Go to the documentation of this file.
00001 #include <time.h>
00002 #include <wchar.h>
00003 
00004 int
00005 main (int argc, char *argv[])
00006 {
00007   wchar_t buf[200];
00008   time_t t;
00009   struct tm *tp;
00010   int result = 0;
00011   size_t n;
00012 
00013   time (&t);
00014   tp = gmtime (&t);
00015 
00016   n = wcsftime (buf, sizeof (buf) / sizeof (buf[0]),
00017               L"%H:%M:%S  %Y-%m-%d\n", tp);
00018   if (n != 21)
00019     result = 1;
00020 
00021   wprintf (L"It is now %ls", buf);
00022 
00023   wcsftime (buf, sizeof (buf) / sizeof (buf[0]), L"%A\n", tp);
00024 
00025   wprintf (L"The weekday is %ls", buf);
00026 
00027   return result;
00028 }