]> git.tuebingen.mpg.de Git - misma.git/commitdiff
Fix seconds_to_human(). master
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 29 Jan 2024 15:42:04 +0000 (16:42 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 8 Feb 2024 14:46:00 +0000 (15:46 +0100)
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

diff --git a/misma.c b/misma.c
index fc9ab3d49d37be67f147c859e652539576234bbb..34040baa121030957193f042a9ed1213a0570793 100644 (file)
--- 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)