Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Stop checking timezone when connecting to a backend, it no longer mat…

…ters for correct functioning.
  • Loading branch information...
commit 7e450b9f2f9b99bbf70351bf29688236bb59eea9 1 parent 4f028f3
@daniel-kristjansson daniel-kristjansson authored
View
45 mythtv/programs/mythbackend/main_helpers.cpp
@@ -461,35 +461,40 @@ int connect_to_master(void)
}
}
- QStringList tzCheck("QUERY_TIME_ZONE");
+ QStringList timeCheck;
if (tempMonitorConnection)
{
- tempMonitorConnection->writeStringList(tzCheck);
- tempMonitorConnection->readStringList(tzCheck);
+ timeCheck.push_back("QUERY_TIME");
+ tempMonitorConnection->writeStringList(timeCheck);
+ tempMonitorConnection->readStringList(timeCheck);
}
- if (tzCheck.size() && !checkTimeZone(tzCheck))
+ if (timeCheck.size() < 3)
+ {
+ return GENERIC_EXIT_SOCKET_ERROR;
+ }
+ tempMonitorConnection->writeStringList(tempMonitorDone);
+
+ QDateTime our_time = MythDate::current();
+ QDateTime master_time = MythDate::fromString(timeCheck[2]);
+ int timediff = abs(our_time.secsTo(master_time));
+
+ if (timediff > 300)
{
- // Check for different time zones, different offsets, different
- // times
- LOG(VB_GENERAL, LOG_ERR, "The time and/or time zone settings on "
- "this system do not match those in use on the master "
- "backend. Please ensure all frontend and backend "
- "systems are configured to use the same time zone and "
- "have the current time properly set.");
LOG(VB_GENERAL, LOG_ERR,
- "Unable to run with invalid time settings. Exiting.");
- tempMonitorConnection->writeStringList(tempMonitorDone);
+ QString("Current time on the master backend differs by "
+ "%1 seconds from time on this system. Exiting.")
+ .arg(timediff));
tempMonitorConnection->DownRef();
- return GENERIC_EXIT_INVALID_TIMEZONE;
+ return GENERIC_EXIT_INVALID_TIME;
}
- else
+
+ if (timediff > 20)
{
- LOG(VB_GENERAL, LOG_INFO,
- QString("Backend is running in %1 time zone.")
- .arg(getTimeZoneID()));
+ LOG(VB_GENERAL, LOG_WARNING,
+ QString("Time difference between the master "
+ "backend and this system is %1 seconds.")
+ .arg(timediff));
}
- if (tempMonitorConnection)
- tempMonitorConnection->writeStringList(tempMonitorDone);
}
if (tempMonitorConnection)
tempMonitorConnection->DownRef();
View
35 mythtv/programs/mythfrontend/backendconnectionmanager.cpp
@@ -33,7 +33,7 @@ class Reconnect : public QRunnable
};
BackendConnectionManager::BackendConnectionManager() :
- QObject(), m_reconnecting(NULL), m_reconnect_timer(NULL), m_first_time(true)
+ QObject(), m_reconnecting(NULL), m_reconnect_timer(NULL)
{
gCoreContext->addListener(this);
@@ -74,39 +74,6 @@ void BackendConnectionManager::customEvent(QEvent *event)
{
delete m_reconnecting;
m_reconnecting = NULL;
- if (m_first_time && !checkTimeZone())
- {
- // Check for different time zones,
- // different offsets, different times
- LOG(VB_GENERAL, LOG_ERR,
- "The time and/or time zone settings on this "
- "system do not match those in use on the master "
- "backend. Please ensure all frontend and backend "
- "systems are configured to use the same time "
- "zone and have the current time properly set.");
- LOG(VB_GENERAL, LOG_ERR,
- "Unable to run with invalid time settings. Exiting.");
- MythScreenStack *popupStack = GetMythMainWindow()->
- GetStack("popup stack");
- QString message = tr("Your frontend and backend are configured "
- "in different timezones. You must "
- "correct this mismatch to continue.");
- MythConfirmationDialog *error = new MythConfirmationDialog(
- popupStack, message, false);
- if (error->Create())
- {
- QObject::connect(error, SIGNAL(haveResult(bool)),
- qApp, SLOT(quit()));
- popupStack->AddScreen(error);
- }
- else
- {
- delete error;
- delete popupStack;
- qApp->exit(GENERIC_EXIT_INVALID_TIMEZONE);
- }
- }
- m_first_time = false;
}
else if (message == "RECONNECT_FAILURE")
{
View
1  mythtv/programs/mythfrontend/backendconnectionmanager.h
@@ -20,5 +20,4 @@ class BackendConnectionManager : public QObject
protected:
Reconnect *m_reconnecting;
QTimer *m_reconnect_timer;
- bool m_first_time;
};
Please sign in to comment.
Something went wrong with that request. Please try again.