Permalink
Browse files

Keep MythUIClock time in UTC internally.

I noticed the frontend doing a lot of stat(/etc/localtime) checks.
It turned out this was because keeping the time to update in localtime
this would lead to the time not being updated for an hour when the
clocks 'spring back', but really the problem is all those unnecessary
time conversions going on.
  • Loading branch information...
daniel-kristjansson committed Jun 22, 2012
1 parent aefe0fc commit 14ad67e0dbd581527e706f019cdc3384592e3371
Showing with 4 additions and 2 deletions.
  1. +4 −2 mythtv/libs/libmythui/mythuiclock.cpp
@@ -10,6 +10,7 @@
#include "mythcorecontext.h"
#include "mythlogging.h"
+#include "mythdate.h"
#include "mythdb.h"
MythUIClock::MythUIClock(MythUIType *parent, const QString &name)
@@ -35,7 +36,7 @@ MythUIClock::~MythUIClock()
*/
void MythUIClock::Pulse(void)
{
- m_Time = QDateTime::currentDateTime();
+ m_Time = MythDate::current();
if (m_nextUpdate.isNull() || (m_Time >= m_nextUpdate))
MythUIText::SetText(GetTimeText());
@@ -52,7 +53,8 @@ void MythUIClock::Pulse(void)
*/
QString MythUIClock::GetTimeText(void)
{
- QString newMsg = gCoreContext->GetQLocale().toString(m_Time, m_Format);
+ QDateTime dt = m_Time.toLocalTime();
+ QString newMsg = gCoreContext->GetQLocale().toString(dt, m_Format);
m_nextUpdate = m_Time.addSecs(1);
m_nextUpdate = QDateTime(

0 comments on commit 14ad67e

Please sign in to comment.