about summary refs log tree commit diff
path: root/time/tst_wcsftime.c
diff options
context:
space:
mode:
Diffstat (limited to 'time/tst_wcsftime.c')
-rw-r--r--time/tst_wcsftime.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/time/tst_wcsftime.c b/time/tst_wcsftime.c
new file mode 100644
index 0000000000..3f6f0d9f77
--- /dev/null
+++ b/time/tst_wcsftime.c
@@ -0,0 +1,28 @@
+#include <time.h>
+#include <wchar.h>
+
+int
+main (int argc, char *argv[])
+{
+  wchar_t buf[200];
+  time_t t;
+  struct tm *tp;
+  int result = 0;
+  size_t n;
+
+  time (&t);
+  tp = gmtime (&t);
+
+  n = wcsftime (buf, sizeof (buf) / sizeof (buf[0]),
+		L"%H:%M:%S  %Y-%m-%d\n", tp);
+  if (n != 21)
+    result = 1;
+
+  wprintf (L"It is now %ls", buf);
+
+  wcsftime (buf, sizeof (buf) / sizeof (buf[0]), L"%A\n", tp);
+
+  wprintf (L"The weekday is %ls", buf);
+
+  return result;
+}