From: Sage Weil Date: Fri, 31 Aug 2018 20:40:31 +0000 (-0500) Subject: include/utime: add utimespan_str helper X-Git-Tag: v14.0.1~357^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a7043dbba6e9036159e89a74d404444d7d5a9db8;p=ceph.git include/utime: add utimespan_str helper Just like timespan_str(), but for utime_t. Signed-off-by: Sage Weil --- diff --git a/src/include/utime.h b/src/include/utime.h index 61fc73f61d17..08db335e246c 100644 --- a/src/include/utime.h +++ b/src/include/utime.h @@ -533,4 +533,9 @@ inline std::ostream& operator<<(std::ostream& out, const utime_t& t) return t.localtime(out); } +inline std::string utimespan_str(const utime_t& age) { + auto age_ts = ceph::timespan(age.nsec()) + std::chrono::seconds(age.sec()); + return timespan_str(age_ts); +} + #endif