daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
4eda52
From 1cbcfc6f69e50d309698b6aa16a48b7f282913f5 Mon Sep 17 00:00:00 2001
4295f9
From: Michal Sekletar <msekleta@redhat.com>
4295f9
Date: Tue, 21 Sep 2021 09:28:29 +0200
4295f9
Subject: [PATCH] basic/time-util: introduce FORMAT_TIMESPAN
4295f9
4295f9
This is cherry-pick of the relevant part from the tree-wide change in
4295f9
5291f26d4a6.
4295f9
4eda52
Related: #2005024
4295f9
---
4295f9
 src/basic/time-util.h | 1 +
4295f9
 1 file changed, 1 insertion(+)
4295f9
4295f9
diff --git a/src/basic/time-util.h b/src/basic/time-util.h
4295f9
index 2bd947d6a8..8254913930 100644
4295f9
--- a/src/basic/time-util.h
4295f9
+++ b/src/basic/time-util.h
4295f9
@@ -67,6 +67,7 @@ typedef enum TimestampStyle {
4295f9
 #define FORMAT_TIMESTAMP_WIDTH 28U /* when outputting, assume this width */
4295f9
 #define FORMAT_TIMESTAMP_RELATIVE_MAX 256U
4295f9
 #define FORMAT_TIMESPAN_MAX 64U
4295f9
+#define FORMAT_TIMESPAN(t, accuracy) format_timespan((char[FORMAT_TIMESPAN_MAX]){}, FORMAT_TIMESPAN_MAX, t, accuracy)
4295f9
 
4295f9
 #define TIME_T_MAX (time_t)((UINTMAX_C(1) << ((sizeof(time_t) << 3) - 1)) - 1)
4295f9