summaryrefslogtreecommitdiff
path: root/tests/datefudge-check.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/datefudge-check.c')
-rw-r--r--tests/datefudge-check.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/datefudge-check.c b/tests/datefudge-check.c
new file mode 100644
index 0000000000..f2d896d622
--- /dev/null
+++ b/tests/datefudge-check.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2019 Red Hat
+ *
+ * Author: Daiki Ueno
+ *
+ * This file is part of GnuTLS.
+ *
+ * GnuTLS is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuTLS is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+int
+main (void)
+{
+ char outstr[200];
+ time_t t;
+ struct tm *tmp;
+
+ t = time(NULL);
+ tmp = localtime(&t);
+ if (tmp == NULL) {
+ perror("localtime");
+ exit(EXIT_FAILURE);
+ }
+
+ if (strftime(outstr, sizeof(outstr), "%s", tmp) == 0) {
+ fprintf(stderr, "strftime returned 0");
+ exit(EXIT_FAILURE);
+ }
+
+ puts(outstr);
+ exit(EXIT_SUCCESS);
+}