]> www.infradead.org Git - mtd-utils.git/commitdiff
mtd-utils: fectest: Fix time formatting with _TIME_BITS=64 on 32-bit system
authorBen Hutchings <ben.hutchings@mind.be>
Fri, 12 Apr 2024 20:55:05 +0000 (22:55 +0200)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Sat, 13 Apr 2024 14:26:37 +0000 (16:26 +0200)
fectest.c formats a struct timeval with the assumption that time_t and
suseconds_t are aliases for long, but some 32-bit systems now define
them as long long in order to support timestamps beyond 2038.

As this is an elapsed time and not a timestamp, both fields should be
within the range of long, so cast them to long before formatting
rather than moving to long long.

Signed-off-by: Ben Hutchings <ben.hutchings@mind.be>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
misc-utils/fectest.c

index eb1d33e1a4329917c87c5bc47c6d18310d650d65..f560f2b4fbae1a7e9a8386b24890447acf967392 100644 (file)
@@ -87,6 +87,6 @@ int main(void)
                exit(1);
        }
 
-       printf("Decoded in %ld.%06lds\n", now.tv_sec, now.tv_usec);
+       printf("Decoded in %ld.%06lds\n", (long)now.tv_sec, (long)now.tv_usec);
        return 0;
 }