summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2023-01-05 11:16:28 +0100
committerJoel Rosdahl <joel@rosdahl.net>2023-01-15 21:33:56 +0100
commit9c93686dfb90f29fbf24c134833a4f41a75cddba (patch)
treee161830476896c54f4378a63de04a0d0fef3d7de
parent00b9a854bc20f5c27937682d266bf0b23142163a (diff)
downloadccache-9c93686dfb90f29fbf24c134833a4f41a75cddba.tar.gz
fix: Fix logging of inactive lock duration
-rw-r--r--src/util/LockFile.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util/LockFile.cpp b/src/util/LockFile.cpp
index a9deab30..467c7b2b 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;
}