[PATCH 04/10] time_stats: add larger units

From: Darrick J. Wong
Date: Fri Feb 23 2024 - 20:11:24 EST


From: Darrick J. Wong <djwong@xxxxxxxxxx>

Filesystems can stay mounted for a very long time, so add some larger
units.

Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
Signed-off-by: Kent Overstreet <kent.overstreet@xxxxxxxxx>
---
lib/time_stats.c | 3 +++
1 file changed, 3 insertions(+)


diff --git a/lib/time_stats.c b/lib/time_stats.c
index 767b1a340e805..43106bda43a92 100644
--- a/lib/time_stats.c
+++ b/lib/time_stats.c
@@ -16,6 +16,9 @@ static const struct time_unit time_units[] = {
{ "s", NSEC_PER_SEC },
{ "m", (u64) NSEC_PER_SEC * 60},
{ "h", (u64) NSEC_PER_SEC * 3600},
+ { "d", (u64) NSEC_PER_SEC * 3600 * 24},
+ { "w", (u64) NSEC_PER_SEC * 3600 * 24 * 7},
+ { "y", (u64) NSEC_PER_SEC * ((3600 * 24 * 7 * 365) + (3600 * (24 / 4) * 7))}, /* 365.25d */
{ "eon", U64_MAX },
};