[date_time] try to show zone offset where appropriate

Related to #703
pull/1161/merge
Tim Stack 10 months ago
parent cc445cc78f
commit 4cd1234cea

@ -313,13 +313,13 @@ date_time_scanner::to_localtime(time_t t, exttm& tm_out)
tm_out.et_tm.tm_isdst = 0;
new_gmt = tm2sec(&tm_out.et_tm);
this->dts_local_offset_cache = t - new_gmt;
this->dts_local_offset_cache = new_gmt - t;
this->dts_local_offset_valid = t;
this->dts_local_offset_expiry = t + (EXPIRE_TIME - 1);
this->dts_local_offset_expiry
-= this->dts_local_offset_expiry % EXPIRE_TIME;
} else {
time_t adjust_gmt = t - this->dts_local_offset_cache;
time_t adjust_gmt = t + this->dts_local_offset_cache;
gmtime_r(&adjust_gmt, &tm_out.et_tm);
}
tm_out.et_gmtoff = 0;

@ -336,6 +336,8 @@ logfile_sub_source::text_value_for_line(textview_curses& tc,
{
adjusted_tm.et_flags &= ~ETF_Z_IS_UTC;
}
adjusted_tm.et_gmtoff
= format->lf_date_time.dts_local_offset_cache;
len = format->lf_date_time.ftime(
buffer,
sizeof(buffer),

@ -981,7 +981,7 @@ ftime_z(char* dst, off_t& off_inout, ssize_t len, const struct exttm& tm)
return;
}
if (tm.et_flags & ETF_Z_FOR_UTC) {
if (tm.et_gmtoff == 0 && tm.et_flags & ETF_Z_FOR_UTC) {
PTIME_APPEND('Z');
return;
}

@ -0,0 +1,3 @@
192.168.202.254 - - [20/Jul/2009:15:59:26 -0700] "GET /vmw/cgi/tramp HTTP/1.0" 200 134 "-" "gPXE/0.9.7"
192.168.202.254 - - [20/Jul/2009:15:59:29 -0700] "GET /vmw/vSphere/default/vmkboot.gz HTTP/1.0" 404 46210 "-" "gPXE/0.9.7"
192.168.202.254 - - [20/Jul/2009:15:59:29 -0700] "GET /vmw/vSphere/default/vmkernel.gz HTTP/1.0" 200 78929 "-" "gPXE/0.9.7"

@ -399,6 +399,8 @@ EOF
run_cap_test env TZ=America/Los_Angeles ./drive_logfile -t -f access_log ${srcdir}/logfile_access_log.0
run_cap_test env TZ=America/Los_Angeles ${lnav_test} -n ${srcdir}/logfile_access_log.0
run_test ./drive_logfile -t -f generic_log ${srcdir}/logfile_tai64n.0
check_output "tai64n timestamps interpreted incorrectly?" <<EOF

Loading…
Cancel
Save