Permalink
Browse files

Use MythDate::current().toTime_t().

This has the same result as QDateTime::currentDateTime().toTime_t(), but avoids a conversion to and from localtime.
  • Loading branch information...
1 parent 462c6eb commit b14972440de88991027efe51eea7ee52e8d62e68 @daniel-kristjansson daniel-kristjansson committed Jul 6, 2012
@@ -32,9 +32,10 @@ using namespace std;
// MythTV headers
#include "mythlogging.h"
#include "mythdbcon.h"
-#include "mthread.h"
#include "mythtimer.h"
+#include "mythdate.h"
#include "logging.h"
+#include "mthread.h"
#include "mythdb.h"
bool is_current_thread(MThread *thread)
@@ -227,8 +228,7 @@ void MThread::RunEpilog(void)
void MThread::ThreadSetup(const QString &name)
{
loggingRegisterThread(name);
- qsrand(QDateTime::currentDateTime().toTime_t() ^
- QTime::currentTime().msec());
+ qsrand(MythDate::current().toTime_t() ^ QTime::currentTime().msec());
}
void MThread::ThreadCleanup(void)
@@ -39,6 +39,7 @@ using namespace std;
#include "logging.h"
#include "mthread.h"
#include "serverpool.h"
+#include "mythdate.h"
#define LOC QString("MythCoreContext: ")
@@ -106,8 +107,7 @@ MythCoreContextPrivate::MythCoreContextPrivate(MythCoreContext *lparent,
m_blockingClient(false)
{
MThread::ThreadSetup("CoreContext");
- srandom(QDateTime::currentDateTime().toTime_t() ^
- QTime::currentTime().msec());
+ srandom(MythDate::current().toTime_t() ^ QTime::currentTime().msec());
}
MythCoreContextPrivate::~MythCoreContextPrivate()
@@ -498,7 +498,7 @@ void OSD::SetText(const QString &window, QHash<QString,QString> &map,
{
int startts = map["startts"].toInt();
int endts = map["endts"].toInt();
- int nowts = QDateTime::currentDateTime().toTime_t();
+ int nowts = MythDate::current().toTime_t();
if (startts > nowts)
{
bar->SetUsed(0);

0 comments on commit b149724

Please sign in to comment.