From 9c93686dfb90f29fbf24c134833a4f41a75cddba Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Thu, 5 Jan 2023 11:16:28 +0100 Subject: [PATCH] fix: Fix logging of inactive lock duration --- src/util/LockFile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; } -- 2.47.2