Always allow timestamps to be printed
If the timestamp is above 9999-12-30, (or 2038-something-something on 32 bit), use XXXX-XX-XX XX:XX:XX as the replacement. The problem with refusing to print timestamps is that our code accepts such timestamps, so we can't really just refuse to process them afterwards. Also, it makes journal files non-portable, because suddently we might completely refuse to print entries which are totally OK on a different machine.
This commit is contained in:
@@ -301,11 +301,6 @@ static int output_timestamp_realtime(FILE *f, sd_journal *j, OutputMode mode, Ou
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to get realtime timestamp: %m");
|
||||
|
||||
if (x > USEC_TIMESTAMP_FORMATTABLE_MAX) {
|
||||
log_error("Timestamp cannot be printed");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (IN_SET(mode, OUTPUT_SHORT_FULL, OUTPUT_WITH_UNIT)) {
|
||||
const char *k;
|
||||
|
||||
@@ -314,7 +309,7 @@ static int output_timestamp_realtime(FILE *f, sd_journal *j, OutputMode mode, Ou
|
||||
else
|
||||
k = format_timestamp(buf, sizeof(buf), x);
|
||||
if (!k) {
|
||||
log_error("Failed to format timestamp.");
|
||||
log_error("Failed to format timestamp: %"PRIu64, x);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user