[mythtv-commits] Ticket #13299: Python Bindings fail to calculate date-time object

MythTV noreply at mythtv.org
Sun Jul 8 10:55:46 UTC 2018

#13299: Python Bindings fail to calculate date-time object
 Reporter:  rcrdnalor          |          Owner:  Raymond Wagner
     Type:  Patch - Bug Fix    |         Status:  new
 Priority:  minor              |      Milestone:  needs_triage
Component:  Bindings - Python  |        Version:  Unspecified
 Severity:  medium             |     Resolution:
 Keywords:                     |  Ticket locked:  0

Comment (by ijc):

 I'm not seeing the offset you are, but then again I'm a) on Debian
 (testing, with 2018c tzinfo package) and in British timezone, so maybe
 there is not LMT in my zoneinfo or maybe it doesn't differ enough to be
 noticeable (perhaps due to my proximity to UTC).

 AIUI you need those "dummy" GMT entries since the data is in mutliple
 consecutive arrays and you need to maintain synchronisation, hence
 inserting them and removing at the end. That seems subtle enough to me to
 be worth a code comment explaining it. But perhaps just using `None` would
 be a better sentinel for a faulty `tt` than using the `GMT` list and a
 separate "these are not good" array, then you would check for `None` in
 the subsequent loops and skip? Or even just use `transitions[i] = ...`
 instead of `transitions.append(...)` and use the `None` entries in the
 array as the sentinel.

 Finally, catching the ValueError seems like a roundabout way of detecting
 these entries, in some sense it is treating the symptom, not the cause --
 is it not possible to distinguish these LMT entries from desired ones
 directly? For example are all entries which are too large for
 `time.gmtime()` LMT entries and never any possibility of being something

 Are the LMT entries the "NULL" ones shown here:

 $ zdump -v /etc/localtime  | grep -E NULL\|2018
 /etc/localtime  -9223372036854775808 = NULL
 /etc/localtime  -9223372036854689408 = NULL
 /etc/localtime  Sun Mar 25 00:59:59 2018 UT = Sun Mar 25 00:59:59 2018 GMT
 isdst=0 gmtoff=0
 /etc/localtime  Sun Mar 25 01:00:00 2018 UT = Sun Mar 25 02:00:00 2018 BST
 isdst=1 gmtoff=3600
 /etc/localtime  Sun Oct 28 00:59:59 2018 UT = Sun Oct 28 01:59:59 2018 BST
 isdst=1 gmtoff=3600
 /etc/localtime  Sun Oct 28 01:00:00 2018 UT = Sun Oct 28 01:00:00 2018 GMT
 isdst=0 gmtoff=0
 /etc/localtime  9223372036854689407 = NULL
 /etc/localtime  9223372036854775807 = NULL

 ??? In which case can either the NULL or the enormous magnitude not be
 used to detect them more directly ? The NULL seems like it might be an
 especially interesting indicator of "something unusual"?

 I wasn't actually able to find any docs on the format of `/etc/localtime`,
 nor of the LMT entries though so maybe it isn't possible to distinguish
 explicitly, but it would be better to try IMHO.

Ticket URL: <https://code.mythtv.org/trac/ticket/13299#comment:2>
MythTV <http://www.mythtv.org>
MythTV Media Center

More information about the mythtv-commits mailing list