Merge pull request #1129 from s-shin/hotfix/daily_file_sink_when_no_datetime_2

Fix one more `msg.time` in daily_file_sink.
This commit is contained in:
Gabi Melman 2019-07-01 13:41:49 +03:00 committed by GitHub
commit b1520a87c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,12 +68,13 @@ protected:
void sink_it_(const details::log_msg &msg) override void sink_it_(const details::log_msg &msg) override
{ {
#ifdef SPDLOG_NO_DATETIME #ifdef SPDLOG_NO_DATETIME
if (log_clock::now() >= rotation_tp_) auto time = log_clock::now();
#else #else
if (msg.time >= rotation_tp_) auto time = msg.time;
#endif #endif
if (time >= rotation_tp_)
{ {
file_helper_.open(FileNameCalc::calc_filename(base_filename_, now_tm(msg.time)), truncate_); file_helper_.open(FileNameCalc::calc_filename(base_filename_, now_tm(time)), truncate_);
rotation_tp_ = next_rotation_tp_(); rotation_tp_ = next_rotation_tp_();
} }
fmt::memory_buffer formatted; fmt::memory_buffer formatted;