Skip to content

Commit

Permalink
Keep MythUIClock time in UTC internally.
Browse files Browse the repository at this point in the history
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 14ad67e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mythtv/libs/libmythui/mythuiclock.cpp
Expand Up @@ -10,6 +10,7 @@

#include "mythcorecontext.h"
#include "mythlogging.h"
#include "mythdate.h"
#include "mythdb.h"

MythUIClock::MythUIClock(MythUIType *parent, const QString &name)
Expand All @@ -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());
Expand All @@ -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(
Expand Down

0 comments on commit 14ad67e

Please sign in to comment.