summaryrefslogtreecommitdiff
path: root/lib/libc/stdtime/difftime.c
diff options
context:
space:
mode:
authorGarrett Wollman <wollman@FreeBSD.org>1996-07-18 18:05:09 +0000
committerGarrett Wollman <wollman@FreeBSD.org>1996-07-18 18:05:09 +0000
commit979a211643ccba0ec4121184236acd4ffa1a8dea (patch)
tree556604079b0f29ac467efe87fa5772892d0018b8 /lib/libc/stdtime/difftime.c
parent89e2ea2b0f066d599b1e71a3e3844cdf1661d784 (diff)
Import the 96h release of ADO's timezone code. This release is
primarily bugfixes, but is also contains a disclaimer of copyright. As we are completely off the vendor branch here, this import has no effect on the source tree.
Notes
svn path=/vendor/tzcode/dist/; revision=17208
Diffstat (limited to 'lib/libc/stdtime/difftime.c')
-rw-r--r--lib/libc/stdtime/difftime.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/libc/stdtime/difftime.c b/lib/libc/stdtime/difftime.c
index 68f9d7eb96c5..f178524f5152 100644
--- a/lib/libc/stdtime/difftime.c
+++ b/lib/libc/stdtime/difftime.c
@@ -1,6 +1,11 @@
+/*
+** This file is in the public domain, so clarified as of
+** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov).
+*/
+
#ifndef lint
#ifndef NOID
-static char elsieid[] = "@(#)difftime.c 7.4";
+static char elsieid[] = "@(#)difftime.c 7.7";
#endif /* !defined NOID */
#endif /* !defined lint */
@@ -43,9 +48,7 @@ const time_t time0;
/*
** Repair delta overflow.
*/
- hibit = 1;
- while ((hibit <<= 1) > 0)
- continue;
+ hibit = (~ (time_t) 0) << (TYPE_BIT(time_t) - 1);
/*
** The following expression rounds twice, which means
** the result may not be the closest to the true answer.
@@ -65,10 +68,10 @@ const time_t time0;
** This problem occurs only with very large differences.
** It's too painful to fix this portably.
** We are not alone in this problem;
- ** many C compilers round twice when converting
+ ** some C compilers round twice when converting
** large unsigned types to small floating types,
** so if time_t is unsigned the "return delta" above
- ** has the same double-rounding problem.
+ ** has the same double-rounding problem with those compilers.
*/
return delta - 2 * (long_double) hibit;
}