From: Joel Rosdahl Date: Thu, 5 Jan 2023 10:16:28 +0000 (+0100) Subject: fix: Fix logging of inactive lock duration X-Git-Tag: v4.8~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c93686dfb90f29fbf24c134833a4f41a75cddba;p=thirdparty%2Fccache.git fix: Fix logging of inactive lock duration --- diff --git a/src/util/LockFile.cpp b/src/util/LockFile.cpp index a9deab30c..467c7b2b3 100644 --- a/src/util/LockFile.cpp +++ b/src/util/LockFile.cpp @@ -229,7 +229,7 @@ LockFile::do_acquire(const bool blocking) while (true) { const auto now = util::TimePoint::now(); const auto my_content = - FMT("{}-{}.{}", content_prefix, now.sec(), now.nsec()); + FMT("{}-{}.{}", content_prefix, now.sec(), now.nsec_decimal_part()); if (symlink(my_content.c_str(), m_lock_file.c_str()) == 0) { // We got the lock. @@ -296,13 +296,13 @@ LockFile::do_acquire(const bool blocking) LOG("Lock {} held by another process active {}.{:03} seconds ago", m_lock_file, inactive_duration.sec(), - inactive_duration.nsec() / 1'000'000); + inactive_duration.nsec_decimal_part() / 1'000'000); } else if (content == initial_content) { // The lock seems to be stale -- break it and try again. LOG("Breaking {} since it has been inactive for {}.{:03} seconds", m_lock_file, inactive_duration.sec(), - inactive_duration.nsec() / 1'000'000); + inactive_duration.nsec_decimal_part() / 1'000'000); if (!Util::unlink_tmp(m_alive_file) || !Util::unlink_tmp(m_lock_file)) { return false; }