[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
make 3.81: showing time differences
From: |
Bruno Haible |
Subject: |
make 3.81: showing time differences |
Date: |
Sat, 27 Oct 2007 23:20:54 +0200 |
User-agent: |
KMail/1.5.4 |
Hi,
With GNU make 3.81 the following warnings were seen:
make[5]: Warning: File `.deps/test-xvasprintf.Po' has modification time 4.8e+02
s in the future
make[2]: Warning: File `Makefile' has modification time 1.1e+02 s in the future
make[1]: Warning: File `Makefile' has modification time 95 s in the future
The notation "4.8e+02 s" is a quite obfuscated way to express "4 minutes".
I'm not asking for conversion of the duration to days, hours, minutes, and
seconds. Just using fixed-point notation instead of exponential notation
is enough: "480 s" is understandable. Here's a patch to achieve this
(note that there is no built-in printf directive that would limit the precision
to 2 digits for values between 0 and 10, and drop fractional parts for values
>= 100).
2007-10-27 Bruno Haible <address@hidden>
* remake.c (f_mtime): Print time difference values between 100 and
ULONG_MAX in fixed-point notation rather than in exponention notation.
--- make-3.81/remake.c.bak 2006-03-20 03:36:37.000000000 +0100
+++ make-3.81/remake.c 2007-10-27 22:08:54.000000000 +0200
@@ -1310,8 +1310,13 @@
(FILE_TIMESTAMP_S (mtime) - FILE_TIMESTAMP_S (now)
+ ((FILE_TIMESTAMP_NS (mtime) - FILE_TIMESTAMP_NS (now))
/ 1e9));
- error (NILF, _("Warning: File `%s' has modification time %.2g s
in the future"),
- file->name, from_now);
+ char from_now_string[100];
+ if (from_now >= 99 && from_now <= ULONG_MAX)
+ sprintf (from_now_string, "%lu", (unsigned long) from_now);
+ else
+ sprintf (from_now_string, "%.2g", from_now);
+ error (NILF, _("Warning: File `%s' has modification time %s s in
the future"),
+ file->name, from_now_string);
#endif
clock_skew_detected = 1;
}
- make 3.81: showing time differences,
Bruno Haible <=