fix: accurate timestamp in daemon logs (#7009)

* fix: accurate timestamp in daemon logs

* fix: gtk build errors

* fixup! fix: gtk build errors

* code review: use system_clock typedefs

* code review: use the full buffer for string view

* fixup! fix: accurate timestamp in daemon logs

* code review: limit exposure of `using`
This commit is contained in:
Yat Ho
2024-08-14 06:57:52 +08:00
committed by GitHub
parent 1ae39f8725
commit 04c115f79c
5 changed files with 45 additions and 23 deletions

View File

@@ -250,9 +250,10 @@ static NSTimeInterval const kUpdateSeconds = 0.75;
auto const file_string = std::string{ currentMessage->file };
NSString* file = [(@(file_string.c_str())).lastPathComponent stringByAppendingFormat:@":%ld", currentMessage->line];
auto const secs_since_1970 = std::chrono::system_clock::to_time_t(currentMessage->when);
NSDictionary* message = @{
@"Message" : @(currentMessage->message.c_str()),
@"Date" : [NSDate dateWithTimeIntervalSince1970:currentMessage->when],
@"Date" : [NSDate dateWithTimeIntervalSince1970:secs_since_1970],
@"Index" : @(currentIndex++), //more accurate when sorting by date
@"Level" : @(currentMessage->level),
@"Name" : name,