]> granicus.if.org Git - file/commitdiff
pass the original 64 bit value to the cdf_ converted to avoid truncation.
authorChristos Zoulas <christos@zoulas.com>
Tue, 6 Jan 2015 02:04:10 +0000 (02:04 +0000)
committerChristos Zoulas <christos@zoulas.com>
Tue, 6 Jan 2015 02:04:10 +0000 (02:04 +0000)
(from Christoph Biedl)

src/print.c

index 0ffce747bc645b5fb0927e70ba0d18ee3ed457bf..25169c69257459d5cdeb396d185814a472ef5ec4 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: print.c,v 1.77 2015/01/02 21:29:39 christos Exp $")
+FILE_RCSID("@(#)$File: print.c,v 1.78 2015/01/06 02:04:10 christos Exp $")
 #endif  /* lint */
 
 #include <string.h>
@@ -232,13 +232,17 @@ protected const char *
 file_fmttime(uint64_t v, int flags, char *buf)
 {
        char *pp;
-       time_t t = (time_t)v;
+       time_t t;
        struct tm *tm;
 
        if (flags & FILE_T_WINDOWS) {
                struct timespec ts;
-               cdf_timestamp_to_timespec(&ts, t);
+               cdf_timestamp_to_timespec(&ts, v);
                t = ts.tv_sec;
+       } else {
+               // XXX: perhaps detect and print something if overflow
+               // on 32 bit time_t?
+               t = (time_t)v;
        }
 
        if (flags & FILE_T_LOCAL) {