Hi,
On 2016-01-28 07:35, Nathan Scott wrote:
> ----- Original Message -----
>> [...]
>> - we should now have very good pmrep coverage in QA
>
> Awesome, thanks Marko! I noticed a buglet in the -z/--hostzone
> handling while I was in there, so I've merged a fix for that (if
> you could review that for me please? taa)
I see two issues here.
The aim for the timezone display was to make it instantly obvious for
the uninitiated what timezones are in play but I think this change is
a small step backwards. Earlier current timezone was printed only if
it was different than the one read from an archive but now with -z a)
it's printed even when there's no difference, b) it's sometimes using
different notation ([billing02] vs EET-2 here), and c) something like
[host] doesn't tell much if you have logged in to a remote system.
The second one is that, as you perhaps noticed, your 1069.out update
changed the timestamps for the test case, you see 20:36:45 but I see
13:36:45 here so the test is now failing for me.
I remember I used surprisingly lot of time with write_ext_header() when
I originally wrote it but seems that it's still not working optimally.
What do you think of the patch below?
(Ok, the test archive is not the best case here as it's using some old
style notation (:Australia/Melbourne) instead of the modern one
(AEDT-11).)
---
qa/1069.out | 2 +-
src/pmrep/pmrep.py | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/qa/1069.out b/qa/1069.out
index 17d6906..0c63467 100644
--- a/qa/1069.out
+++ b/qa/1069.out
@@ -38,7 +38,7 @@ Interval can't be less than 1 second.
archive: QAPATH/archives/sample-secs
host: rattle
- timezone: :Australia/Melbourne (creation, current is [rattle])
+ timezone: :Australia/Melbourne (creation, current is AEDT-11)
start: Mon May 1 20:36:45 2000
end: Mon May 1 20:36:53 2000
metrics: 2
diff --git a/src/pmrep/pmrep.py b/src/pmrep/pmrep.py
index 3ce1ee0..740c9f7 100644
--- a/src/pmrep/pmrep.py
+++ b/src/pmrep/pmrep.py
@@ -784,6 +784,9 @@ class PMReporter(object):
self.delimiter = OUTSEP
# Time
+ if self.opts.pmGetOptionHostZone():
+ os.environ['TZ'] = self.context.pmWhichZone()
+ time.tzset()
if self.opts.pmGetOptionTimezone():
os.environ['TZ'] = self.opts.pmGetOptionTimezone()
time.tzset()
@@ -1044,8 +1047,6 @@ class PMReporter(object):
# Figure out the current timezone using the PCP convention
if self.opts.pmGetOptionTimezone():
currtz = self.opts.pmGetOptionTimezone()
- elif self.opts.pmGetOptionHostZone():
- currtz = "[" + self.context.pmGetContextHostName() + "]"
else:
dst = time.localtime().tm_isdst
offset = time.altzone if dst else time.timezone
Thanks,
--
Marko Myllynen
|