summaryrefslogtreecommitdiff
path: root/tcl/compat/gettod.c
diff options
context:
space:
mode:
Diffstat (limited to 'tcl/compat/gettod.c')
-rw-r--r--tcl/compat/gettod.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tcl/compat/gettod.c b/tcl/compat/gettod.c
new file mode 100644
index 00000000000..d95907bca73
--- /dev/null
+++ b/tcl/compat/gettod.c
@@ -0,0 +1,32 @@
+/*
+ * gettod.c --
+ *
+ * This file provides the gettimeofday function on systems
+ * that only have the System V ftime function.
+ *
+ * Copyright (c) 1995 Sun Microsystems, Inc.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * RCS: @(#) $Id$
+ */
+
+#include "tcl.h"
+#include "tclPort.h"
+#include <sys/timeb.h>
+
+#undef timezone
+
+int
+gettimeofday(tp, tz)
+struct timeval *tp;
+struct timezone *tz;
+{
+ struct timeb t;
+ ftime(&t);
+ tp->tv_sec = t.time;
+ tp->tv_usec = t. millitm * 1000;
+ return 0;
+}
+