summaryrefslogtreecommitdiff
path: root/lib/monotime.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/monotime.h')
-rw-r--r--lib/monotime.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/monotime.h b/lib/monotime.h
index 8e50c1874a..00b9400462 100644
--- a/lib/monotime.h
+++ b/lib/monotime.h
@@ -80,4 +80,15 @@ static inline int64_t monotime_until(const struct timeval *ref,
return (int64_t)tv.tv_sec * 1000000LL + tv.tv_usec;
}
+static inline char *time_to_string(time_t ts)
+{
+ struct timeval tv;
+ time_t tbuf;
+
+ monotime(&tv);
+ tbuf = time(NULL) - (tv.tv_sec - ts);
+
+ return ctime(&tbuf);
+}
+
#endif /* _FRR_MONOTIME_H */