summaryrefslogtreecommitdiff
path: root/gnulib-tests/test-gettimeofday.c
diff options
context:
space:
mode:
authorJunfeng Dong <junfeng.dong@intel.com>2012-06-05 17:27:50 +0800
committerJunfeng Dong <junfeng.dong@intel.com>2012-06-05 17:27:50 +0800
commitb5e47a5b56f360f78f0e086ca4af3159dcb28e27 (patch)
tree7df6f7ef0ec82bdabd93c5bee5f1e2e78ba36582 /gnulib-tests/test-gettimeofday.c
parent94865d2997df82fb40f0092682e090614dd98b7f (diff)
downloaddiffutils-2.0alpha.tar.gz
diffutils-2.0alpha.tar.bz2
diffutils-2.0alpha.zip
Upload missing source files.HEAD2.0_alphamaster2.0alpha1.0_post
Diffstat (limited to 'gnulib-tests/test-gettimeofday.c')
-rw-r--r--gnulib-tests/test-gettimeofday.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/gnulib-tests/test-gettimeofday.c b/gnulib-tests/test-gettimeofday.c
new file mode 100644
index 0000000..62142aa
--- /dev/null
+++ b/gnulib-tests/test-gettimeofday.c
@@ -0,0 +1,49 @@
+/* -*- buffer-read-only: t -*- vi: set ro: */
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+/*
+ * Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
+ * Written by Jim Meyering.
+ *
+ * This program 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.
+ *
+ * This program 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 General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include <sys/time.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (gettimeofday, int,
+ (struct timeval *, GETTIMEOFDAY_TIMEZONE *));
+
+#include <time.h>
+
+#include <stdio.h>
+#include <string.h>
+
+int
+main (void)
+{
+ time_t t = 0;
+ struct tm *lt;
+ struct tm saved_lt;
+ struct timeval tv;
+ lt = localtime (&t);
+ saved_lt = *lt;
+ gettimeofday (&tv, NULL);
+ if (memcmp (lt, &saved_lt, sizeof (struct tm)) != 0)
+ {
+ fprintf (stderr, "gettimeofday still clobbers the localtime buffer!\n");
+ return 1;
+ }
+ return 0;
+}