Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/time explicitly promote to double.



details:   https://anonhg.NetBSD.org/src/rev/af0a0d6a51b3
branches:  trunk
changeset: 997994:af0a0d6a51b3
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Apr 04 19:25:38 2019 +0000

description:
explicitly promote to double.

diffstat:

 lib/libc/time/difftime.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 5e18dd02c153 -r af0a0d6a51b3 lib/libc/time/difftime.c
--- a/lib/libc/time/difftime.c  Thu Apr 04 18:19:41 2019 +0000
+++ b/lib/libc/time/difftime.c  Thu Apr 04 19:25:38 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: difftime.c,v 1.21 2019/01/27 04:38:38 dholland Exp $   */
+/*     $NetBSD: difftime.c,v 1.22 2019/04/04 19:25:38 christos Exp $   */
 
 /* Return the difference between two timestamps.  */
 
@@ -12,7 +12,7 @@
 #if 0
 static char    elsieid[] = "@(#)difftime.c     8.1";
 #else
-__RCSID("$NetBSD: difftime.c,v 1.21 2019/01/27 04:38:38 dholland Exp $");
+__RCSID("$NetBSD: difftime.c,v 1.22 2019/04/04 19:25:38 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -45,13 +45,14 @@
        ** if the minuend is greater than or equal to the subtrahend.
        */
        if (!TYPE_SIGNED(time_t))
-               return time0 <= time1 ? time1 - time0 : dminus(time0 - time1);
+               return time0 <= time1 ? time1 - time0 :
+                   dminus((double)(time0 - time1));
 
        /* Use uintmax_t if wide enough.  */
        /*CONSTCOND*/
        if (sizeof (time_t) <= sizeof (uintmax_t)) {
                uintmax_t t1 = time1, t0 = time0;
-               return time0 <= time1 ? t1 - t0 : dminus(t0 - t1);
+               return time0 <= time1 ? t1 - t0 : dminus((double)(t0 - t1));
        }
 
        /*



Home | Main Index | Thread Index | Old Index