Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 87947 | Differences between
and this patch

Collapse All | Expand All

(-)mythtv-0.17-org/libs/libmyth/util.cpp (+17 lines)
Lines 742-747 Link Here
742
    return text;
742
    return text;
743
}
743
}
744
744
745
int MythSecsTo(const QDateTime &from, const QDateTime &to)
746
{
747
   return (from.time().secsTo(to.time()) +
748
           from.date().daysTo(to.date()) * 60 * 60 * 24);
749
}
750
751
QDateTime MythUTCToLocal(const QDateTime &utc)
752
{
753
    QDateTime local = QDateTime(QDate(1970, 1, 1));
754
755
    int timesecs = MythSecsTo(local, utc);
756
    QDateTime localdt;
757
    localdt.setTime_t(timesecs);
758
759
    return localdt;
760
}
761
    
745
long long stringToLongLong(const QString &str)
762
long long stringToLongLong(const QString &str)
746
{
763
{
747
    long long retval = 0;
764
    long long retval = 0;
(-)mythtv-0.17-org/libs/libmyth/util.h (+4 lines)
Lines 3-8 Link Here
3
3
4
#include <qsocket.h>
4
#include <qsocket.h>
5
#include <qstringlist.h>
5
#include <qstringlist.h>
6
#include <qdatetime.h> 
6
#include <qcolor.h>
7
#include <qcolor.h>
7
8
8
#include <time.h>
9
#include <time.h>
Lines 47-52 Link Here
47
48
48
QString cutDownString(QString text, QFont *testFont, int maxwidth);
49
QString cutDownString(QString text, QFont *testFont, int maxwidth);
49
50
51
QDateTime MythUTCToLocal(const QDateTime &utc);
52
int MythSecsTo(const QDateTime &from, const QDateTime &to);
53
50
long long stringToLongLong(const QString &str);
54
long long stringToLongLong(const QString &str);
51
QString longLongToString(long long ll);
55
QString longLongToString(long long ll);
52
56
(-)mythtv-0.17-org/libs/libmythtv/datadirect.cpp (-9 / +3 lines)
Lines 1-6 Link Here
1
#include "datadirect.h"
1
#include "datadirect.h"
2
#include "../libmyth/mythwidgets.h"
2
#include "../libmyth/mythwidgets.h"
3
#include "../libmyth/mythcontext.h"
3
#include "../libmyth/mythcontext.h"
4
#include "util.h"
4
5
5
#include <qfile.h>
6
#include <qfile.h>
6
#include <qstring.h>
7
#include <qstring.h>
Lines 68-83 Link Here
68
        curr_schedule.stationid = pxmlatts.value("station");
69
        curr_schedule.stationid = pxmlatts.value("station");
69
70
70
        QString timestr = pxmlatts.value("time");
71
        QString timestr = pxmlatts.value("time");
71
        QDateTime basedt = QDateTime(QDate(1970, 1, 1));
72
        QDateTime UTCdt= QDateTime::fromString(timestr, Qt::ISODate); 
72
73
73
        QDateTime UTCdt;
74
        curr_schedule.time = MythUTCToLocal(UTCdt);
74
        QDateTime localdt;
75
        UTCdt = QDateTime::fromString(pxmlatts.value("time"), Qt::ISODate);
76
77
        int timesecs = basedt.secsTo(UTCdt);
78
        localdt.setTime_t(timesecs);
79
80
        curr_schedule.time = localdt;
81
        QString durstr;
75
        QString durstr;
82
76
83
        durstr = pxmlatts.value("duration");
77
        durstr = pxmlatts.value("duration");
(-)mythtv-0.17-org/libs/libmythtv/siparser.cpp (-19 / +4 lines)
Lines 931-947 Link Here
931
    QDateTime UTCTime = QDateTime(QDate(year,month,day),QTime(hour,min,sec));
931
    QDateTime UTCTime = QDateTime(QDate(year,month,day),QTime(hour,min,sec));
932
932
933
    // Convert to localtime
933
    // Convert to localtime
934
    QDateTime EPOCTime = QDateTime(QDate(1970, 1, 1));
934
    return MythUTCToLocal(UTCTime);
935
    int timesecs = EPOCTime.secsTo(UTCTime);
936
937
    QDateTime LocalTime;
938
939
    LocalTime.setTime_t(timesecs);
940
941
    QString UTCText = UTCTime.toString();
942
    QString LocalText = LocalTime.toString();
943
944
    return LocalTime;
945
935
946
}
936
}
947
937
Lines 1993-2006 Link Here
1993
    // Get event time and add on GPS Second Difference
1983
    // Get event time and add on GPS Second Difference
1994
//    QDateTime UTCTime = ATSCEPOC.addSecs(offset - (((STTHandler*) Table[STT])->GPSOffset) );
1984
//    QDateTime UTCTime = ATSCEPOC.addSecs(offset - (((STTHandler*) Table[STT])->GPSOffset) );
1995
    QDateTime UTCTime = ATSCEPOC.addSecs(offset - 13 );
1985
    QDateTime UTCTime = ATSCEPOC.addSecs(offset - 13 );
1996
    // Get UTC
1986
1997
    QDateTime UTCEPOC = QDateTime(QDate(1970,1,1));
1987
    // Convert to localtime
1998
    // Now sloppily convert it to localtime
1988
    return MythUTCToLocal(UTCTime);
1999
2000
    int timesecs = UTCEPOC.secsTo(UTCTime);
2001
    QDateTime LocalTime;
2002
    LocalTime.setTime_t(timesecs);
2003
    return LocalTime;
2004
}
1989
}
2005
1990
2006
/*
1991
/*
(-)mythtv-0.17-org/programs/mythfilldatabase/filldata.cpp (-7 / +2 lines)
Lines 1013-1025 Link Here
1013
1013
1014
    if (!quiet)
1014
    if (!quiet)
1015
        cout << "Clearing data for source...\n";
1015
        cout << "Clearing data for source...\n";
1016
    QDateTime basedt = QDateTime(QDate(1970, 1, 1));
1016
    QDateTime fromlocaldt= MythUTCToLocal(ddprocessor.getActualListingsFrom());
1017
    QDateTime fromlocaldt;
1017
    QDateTime tolocaldt= MythUTCToLocal(ddprocessor.getActualListingsTo());
1018
    int timesecs = basedt.secsTo(ddprocessor.getActualListingsFrom());
1019
    fromlocaldt.setTime_t(timesecs);
1020
    QDateTime tolocaldt;
1021
    timesecs = basedt.secsTo(ddprocessor.getActualListingsTo());
1022
    tolocaldt.setTime_t(timesecs);
1023
1018
1024
    if (!quiet)
1019
    if (!quiet)
1025
        cout << "Clearing from " << fromlocaldt.toString() 
1020
        cout << "Clearing from " << fromlocaldt.toString() 

Return to bug 87947