From cb757209d438afe23b5bdbfa5f62d00b195ad367 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 1 May 2020 12:51:06 +0200 Subject: fix timestamp handling As it turns out, the "local timestamp" as advertised by arcdps is a bit misleading, because the timestamp is still in UTC. The "local" refers to the fact that it can lag behind the server timestamp a bit (but usually they seem to be within +-1 of each other), not that the timestamp is in the local timezone. This makes date handling a bit harder for raidgrep, but thanks to chrono, not by much. The idea is that we simply deal with Utc pretty much everywhere, except at the user boundary. This means that 1. Input timestamps for -before and -after are converted to Utc right after input 2. When outputting, we convert to a local timestamp first This makes the output consistent with the filenames now (and the "wall time" that the player saw). --- src/output/formats.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/output') diff --git a/src/output/formats.rs b/src/output/formats.rs index a608eab..10d84fc 100644 --- a/src/output/formats.rs +++ b/src/output/formats.rs @@ -4,6 +4,8 @@ use std::fmt::Write; use super::super::guilds; use super::{FightOutcome, LogResult}; +use chrono::Local; + /// An output format pub trait Format: Sync + Send { /// Format a single log result @@ -30,7 +32,9 @@ impl Format for HumanReadable { result, "{}: {} - {}: {} {}", "Date".green(), - item.time.format("%Y-%m-%d %H:%M:%S %a"), + item.time + .with_timezone(&Local) + .format("%Y-%m-%d %H:%M:%S %a"), "Boss".green(), item.boss_name, outcome, -- cgit v1.2.3