[mythtv-users] Potential Problem With Switch Back to Standard Time

Kevin Atkinson kevin at atkinson.dhs.org
Sat Oct 29 12:14:12 EDT 2005

[List should probably also go to the dev list also, if I don't get a 
response from any developers I will likely post it there also...]

I am not a developer but I just spent the last 3+ hours investigation the 

The switch back to Standard Time this Sunday is likely to mess MythTV
up.  If you are getting your data from the Data Direct service form 
zap2it labs the most likely behavior is that everything will be off by an 
hour.  However, rereading the program data back in should to fix the 
problem.  If you get your data from a web page than your schedule may or 
may not be correct.

The reason for the anomaly when using the Data Direct service is 
because the times are given in UTC and MythTV converts them to local time 
without accounting for the switch.  There is a slight possibility that 
MythTV may correct for the problem and update the program guide when it 
detects the switchover.  However I do not think MythTV will do this.

For users who get there data from a web page this anomaly in unlikely
because the times are probably already in local time.

However, in both case, if you try to record something between 1:00-2:00,
MythTV may act in strange ways as at 2:00 the time gets reset back to
1:00.  MythTV could record a show twice or it could do any number of other
things, hopefully it won't wipe your hard drive ;).  From that point on
the guide will than be off by an hour until it gets reread from the

However, there will be problem even if MythTV correctly detected the
switch back to standard time due to the fact that programs times are
stored in the database in in _local_ time.  This means that it is
_impossible_ to store program information for the extra hour AND also keep
the listing accurate across the switch back to standard time.  Thus there
is the choice to ignore the switch and just lets things be off by an hour
until the user notices and corrects for the problem (or until the program
data expires and new data is read in with the correct adjustment) or make
it impossible to to record a program during this extra hour By just
ignoring the the switch the user has some hope of recording something
during the extra hour AND keeping the schedule consistent by tricking the
computer into NOT adjusting the clock for the switch.

The real solution to this problem is to store all times in the database in
_UTC_ and only convert it back to local time when displaying it to the
user.  All program times entered in my the user should thus be converted
to UTC.  This way there are no anomalies during the switch.  MythTV may
also need to be aware of when the switch happens in order to correctly
display the Grid and program times before and after the switch.  The only
major problem is that manually recording a program during the extra hour
will be impossible without some sort of special feature of the GUI to
indicate _which_ 1:00 the user meant.

Thus, I _*STRONGLY*_ suggest that MythTV be modified to store the Program
Times in UTC rather than local time.  Of course this will create a
migration problem.  The easiest solution is to automatically convert all
the exiting program times to UTC in the database when a user first uses a
newer version of MythTV.  Once the data is converted a extra flag can be
stored somewhere that the program times are now in UTC and they should not
be converted again.  This switch should be well documented so that the
user us aware of the change in case he downgrades to an version of MythTV
that still uses local time.  In this case there should be a way to convert
the program data from UTC back to Local Time.

Since I am recording stuff during the extra hour I set my time zone to 
"GMT+6" which is the same as MDT but hopefully won't change during the 
switch back to standard time.  I did this by using "tzconfig" and then 
selecting "11" for "None of the Above" and then selected "GMT+6".  This 
should work for most Debian based systems.  Other distributions likely have a 
different way of setting the timezone.  I will still be watching MythTV 
closely to make sure it doesn't do anything funny (I don't normally go to 
bead before 3:00 anyway).

BTW: I noticed this problem because mythweb is somehow accounting for the
switch when displaying the grid, but it is not doing it correctly since
there is a gap in the schedule during the extra hour when nothing is
shown, and the times are all wrong after words.  So thank you mythweb
developers for incorrectly hading the switch, otherwise I would have not
noticed this problem until it was too late :-|


More information about the mythtv-users mailing list