Index: programs/mythfilldatabase/filldata.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfilldatabase/filldata.cpp,v
retrieving revision 1.166
diff -u -r1.166 filldata.cpp
--- programs/mythfilldatabase/filldata.cpp	11 Apr 2005 17:54:49 -0000	1.166
+++ programs/mythfilldatabase/filldata.cpp	12 Apr 2005 13:26:22 -0000
@@ -1039,37 +1039,6 @@
 
 // XMLTV stuff
 
-QDateTime fromXMLTVDate(QString &text)
-{
-    int year, month, day, hour, min, sec;
-    QDate ldate;
-    QTime ltime;
-    QDateTime dt;
-
-    if (text == QString::null)
-        return dt;
-
-    if (text.find(QRegExp("^\\d{12}")) != 0)
-        return dt;
-
-    year = atoi(text.mid(0, 4).ascii());
-    month = atoi(text.mid(4, 2).ascii());
-    day = atoi(text.mid(6, 2).ascii());
-    hour = atoi(text.mid(8, 2).ascii());
-    min = atoi(text.mid(10, 2).ascii());
-    if (text.find(QRegExp("^\\d\\d"), 12) == 0)
-        sec = atoi(text.mid(12, 2).ascii());
-    else
-        sec = 0;
-
-    ldate = QDate(year, month, day);
-    ltime = QTime(hour, min, sec);
-
-    dt = QDateTime(ldate, ltime);
-
-    return dt; 
-}
-
 QString getFirstText(QDomElement element)
 {
     for (QDomNode dname = element.firstChild(); !dname.isNull();
@@ -1207,63 +1176,70 @@
     return result;
 }
 
-void addTimeOffset(QString &timestr, int localTimezoneOffset)
+// localTimezoneOffset: 841 == "None", -841 == "Auto", other == fixed offset
+void fromXMLTVDate(QString &timestr, QDateTime &dt, int localTimezoneOffset = 841)
 {
-    if (timestr.isEmpty() || abs(localTimezoneOffset) > 840)
+    if (timestr.isEmpty())
+    {
+        cerr << "Ignoring empty timestamp." << endl;
         return;
+    }
 
     QStringList split = QStringList::split(" ", timestr);
     QString ts = split[0];
-    int ts_offset = localTimezoneOffset;
+    bool ok;
+    int year = 0, month = 0, day = 0, hour = 0, min = 0, sec = 0;
 
-    if (split.size() > 1)
+    if (ts.length() == 14)
+    {
+        year  = ts.left(4).toInt(&ok, 10);
+        month = ts.mid(4,2).toInt(&ok, 10);
+        day   = ts.mid(6,2).toInt(&ok, 10);
+        hour  = ts.mid(8,2).toInt(&ok, 10);
+        min   = ts.mid(10,2).toInt(&ok, 10);
+        sec   = ts.mid(12,2).toInt(&ok, 10);
+    }
+    else if (ts.length() == 12)
+    {
+        year  = ts.left(4).toInt(&ok, 10);
+        month = ts.mid(4,2).toInt(&ok, 10);
+        day   = ts.mid(6,2).toInt(&ok, 10);
+        hour  = ts.mid(8,2).toInt(&ok, 10);
+        min   = ts.mid(10,2).toInt(&ok, 10);
+        sec   = 0;
+    }
+    else
+    {
+        cerr << "Ignoring unknown timestamp format: " << ts << endl;
+        return;
+    }
+
+    dt = QDateTime(QDate(year, month, day),QTime(hour, min, sec));
+
+    if ((split.size() > 1) && (localTimezoneOffset <= 840))
     {
         QString tmp = split[1];
         tmp.stripWhiteSpace();
 
-        ts_offset = TimezoneToInt(tmp);
+        int ts_offset = TimezoneToInt(tmp);
         if (abs(ts_offset) > 840)
-            ts_offset = localTimezoneOffset;
+        {
+            ts_offset = 0;
+            localTimezoneOffset = 841;
+        }
+        dt = dt.addSecs(-ts_offset * 60);
     }
 
-    int diff = localTimezoneOffset - ts_offset;
-    int year = 0, month = 0, day = 0, hour = 0, min = 0, sec = 0;
-
-    if (diff != 0)
+    if (localTimezoneOffset < -840)
     {
-        bool ok;
-                    
-            if (ts.length() == 14)
-            {
-                year  = ts.left(4).toInt(&ok, 10);
-                month = ts.mid(4,2).toInt(&ok, 10);
-                day   = ts.mid(6,2).toInt(&ok, 10);
-                hour  = ts.mid(8,2).toInt(&ok, 10);
-                min   = ts.mid(10,2).toInt(&ok, 10);
-                sec   = ts.mid(12,2).toInt(&ok, 10);
-            }
-            else if (ts.length() == 12)
-            {
-                year  = ts.left(4).toInt(&ok, 10);
-                month = ts.mid(4,2).toInt(&ok, 10);
-                day   = ts.mid(6,2).toInt(&ok, 10);
-                hour  = ts.mid(8,2).toInt(&ok, 10);
-                min   = ts.mid(10,2).toInt(&ok, 10);
-                sec   = 0;
-            }
-            else
-            {
-                diff = 0;
-                cerr << "Ignoring unknown timestamp format: " << ts << endl;
-            }
+        dt = MythUTCToLocal(dt);
     }
-
-    if (diff != 0)
+    else if (abs(localTimezoneOffset) <= 840)
     {
-        QDateTime dt = QDateTime(QDate(year, month, day),QTime(hour, min, sec));
-        dt = dt.addSecs(diff * 60 );
-        timestr = dt.toString("yyyyMMddhhmmss");
+        dt = dt.addSecs(localTimezoneOffset * 60 );
     }
+
+    timestr = dt.toString("yyyyMMddhhmmss");
 }
 
 void parseCredits(QDomElement &element, ProgInfo *pginfo)
@@ -1297,11 +1273,11 @@
     pginfo->stars = "";
 
     QString text = element.attribute("start", "");
-    addTimeOffset(text, localTimezoneOffset);
+    fromXMLTVDate(text, pginfo->start, localTimezoneOffset);
     pginfo->startts = text;
 
     text = element.attribute("stop", "");
-    addTimeOffset(text, localTimezoneOffset);
+    fromXMLTVDate(text, pginfo->end, localTimezoneOffset);
     pginfo->endts = text;
 
     text = element.attribute("channel", "");
@@ -1317,9 +1293,6 @@
         pginfo->clumpmax = split[1];
     }
 
-    pginfo->start = fromXMLTVDate(pginfo->startts);
-    pginfo->end = fromXMLTVDate(pginfo->endts);
-
     for (QDomNode child = element.firstChild(); !child.isNull();
          child = child.nextSibling())
     {
@@ -1594,16 +1567,16 @@
 
     if (config_offset == "Auto")
     {
-        time_t now = time(NULL);
-        struct tm local_tm;
-        localtime_r(&now, &local_tm);
-        localTimezoneOffset = local_tm.tm_gmtoff / 60;
+        localTimezoneOffset = -841; // we mark auto with the -ve of the disable magic number
     }
     else if (config_offset != "None")
     {
         localTimezoneOffset = TimezoneToInt(config_offset);
         if (abs(localTimezoneOffset) > 840)
+        {
             cerr << "Ignoring invalid TimeOffset " << config_offset << endl;
+            localTimezoneOffset = 841;
+        }
     }
 
     QDomElement docElem = doc.documentElement();
Index: setup/backendsettings.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/setup/backendsettings.cpp,v
retrieving revision 1.38
diff -u -r1.38 backendsettings.cpp
--- setup/backendsettings.cpp	27 Mar 2005 23:53:22 -0000	1.38
+++ setup/backendsettings.cpp	12 Apr 2005 13:26:23 -0000
@@ -230,11 +230,10 @@
     gc->addSelection("-0130");
     gc->addSelection("-0100");
     gc->addSelection("-0030");
-    gc->setHelpText(QObject::tr("If your local timezone does not match the "
-                    "timezone returned by XMLTV, use this setting to have "
-                    "mythfilldatabase adjust the program start and end times."
-                    "None disables this feature, Auto automatically "
-                    "detects your local timezone"));
+    gc->setHelpText(QObject::tr("Adjust the relative timezone of the XMLTV EPG data read "
+                    "by mythfilldatabase.  'Auto' converts the XMLTV time to local time "
+                    "using your computer's timezone.  'None' ignores the "
+                    "XMLTV timezone, interpreting times as local."));
     return gc;
 };
 
