From: Andre Noll Date: Mon, 29 Jan 2024 15:42:04 +0000 (+0100) Subject: Fix seconds_to_human(). X-Git-Url: http://git.tuebingen.mpg.de/versions/paraslash-0.3.1.tar.bz2.asc?a=commitdiff_plain;h=f74ade43d9510d96c4a6617c51d1c763202d6f1c;p=misma.git 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. --- 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)