Skip to content

Commit

Permalink
Fix debug build when log_timestamp_ordering_grace_period is set to ze…
Browse files Browse the repository at this point in the history
…ro (#607)
  • Loading branch information
odygrd authored Oct 10, 2024
1 parent 602fdb5 commit 4120511
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
used to create another `Logger` with similar configuration
- Fixed a build issue when compiling with `-fno-rtti`. This ensures compatibility with projects that disable
`RTTI` ([#604](https://github.com/odygrd/quill/issues/604))
- Fixed an incorrectly triggered assertion in debug builds when `BackendOptions::log_timestamp_ordering_grace_period` is
set to 0 ([#605](https://github.com/odygrd/quill/issues/605))

## v7.3.0

Expand Down
10 changes: 6 additions & 4 deletions include/quill/backend/BackendWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -517,13 +517,15 @@ class BackendWorker
_rdtsc_clock.load(std::memory_order_relaxed)->time_since_epoch(transit_event->timestamp);
}

// Check if strict log timestamp order is enabled and the clock source is not User.
if (transit_event->logger_base->clock_source != ClockSourceType::User)
// Check if strict log timestamp order is enabled and the clock source is not User
if ((transit_event->logger_base->clock_source != ClockSourceType::User) &&
(ts_now != std::numeric_limits<uint64_t>::max()))
{
// We skip checking against `ts_now` for custom timestamps by the user
// We only check against `ts_now` for real timestamps, not custom timestamps by the user, and
// when the grace period is enabled

#ifndef NDEBUG
// Check the timestmaps we are comparign have the same digits
// Check the timestamps we are comparing have the same digits
auto count_digits = [](uint64_t number)
{
uint32_t digits = 0;
Expand Down

0 comments on commit 4120511

Please sign in to comment.