From f74ade43d9510d96c4a6617c51d1c763202d6f1c Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 29 Jan 2024 16:42:04 +0100 Subject: [PATCH] Fix seconds_to_human(). This function contains two bugs: First, the age of a snapshot is only shown in months if it is older than four months rather than two. Second, the number of months is calculated incorrectly. --- misma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misma.c b/misma.c index fc9ab3d..34040ba 100644 --- a/misma.c +++ b/misma.c @@ -1256,8 +1256,8 @@ static void seconds_to_human(int64_t diff, char *buf) { if (diff > 2 * 86400 * 365) sprintf(buf, "%3" PRId64 " years ", diff / (86400 * 365)); - else if (diff > 2 * 86400 * 60) - sprintf(buf, "%3" PRId64 " months ", diff / (86400 * 60)); + else if (diff > 2 * 86400 * 30) + sprintf(buf, "%3" PRId64 " months ", diff / (86400 * 30)); else if (diff > 2 * 86400 * 7) sprintf(buf, "%3" PRId64 " weeks ", diff / (86400 * 7)); else if (diff > 2 * 86400) -- 2.39.5