summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2015-02-10 01:24:29 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2015-02-10 01:24:29 +0000
commit520c53010659494805794c8979cd54b528392901 (patch)
tree27ca2cb3df2a93772aba387221a678b5a0ce179d /lib
parent0c083014da7c5a944143cfa13b0145848a2fa11e (diff)
now we're cooking with gas...
replace difftime with a clever gift from matthew. ok guenther.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/time/difftime.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libc/time/difftime.c b/lib/libc/time/difftime.c
index 88b8024b82d..285e535f215 100644
--- a/lib/libc/time/difftime.c
+++ b/lib/libc/time/difftime.c
@@ -1,10 +1,13 @@
-/* $OpenBSD: difftime.c,v 1.11 2015/02/10 00:58:28 tedu Exp $ */
-/* This file is placed in the public domain by Ted Unangst. */
+/* $OpenBSD: difftime.c,v 1.12 2015/02/10 01:24:28 tedu Exp $ */
+/* This file is placed in the public domain by Matthew Dempsky. */
#include "private.h"
+#define HI(t) ((double)(t & 0xffffffff00000000LL))
+#define LO(t) ((double)(t & 0x00000000ffffffffLL))
+
double
-difftime(time_t time1, time_t time0)
+difftime(time_t t1, time_t t0)
{
- return time1 - (double)time0;
+ return (HI(t1) - HI(t0)) + (LO(t1) - LO(t0));
}