]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/monotime.h
Merge pull request #3356 from opensourcerouting/router-id-loopbacks
[mirror_frr.git] / lib / monotime.h
index 8e50c1874ade466415ac85b4c34b083783738b99..00b9400462e2f6c8b6e49c29ae6e1099fd80854c 100644 (file)
@@ -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 */