CC-1894: Warn users about time zone differences or clock drift problems on the server
-Now using timezone offsets from UTC instead of regions to compare timezones between pypo and the airtime webserver
This commit is contained in:
parent
36a68aa589
commit
8a2610aa84
|
@ -716,7 +716,7 @@ class Schedule {
|
||||||
$result['stream_metadata'] = array();
|
$result['stream_metadata'] = array();
|
||||||
$result['stream_metadata']['format'] = Application_Model_Preference::GetStreamLabelFormat();
|
$result['stream_metadata']['format'] = Application_Model_Preference::GetStreamLabelFormat();
|
||||||
$result['stream_metadata']['station_name'] = Application_Model_Preference::GetStationName();
|
$result['stream_metadata']['station_name'] = Application_Model_Preference::GetStationName();
|
||||||
$result['server_timezone'] = date_default_timezone_get();
|
$result['server_timezone'] = date('O');
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import json
|
||||||
import telnetlib
|
import telnetlib
|
||||||
import math
|
import math
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
# For RabbitMQ
|
# For RabbitMQ
|
||||||
from kombu.connection import BrokerConnection
|
from kombu.connection import BrokerConnection
|
||||||
|
@ -78,13 +79,14 @@ class PypoFetch(Thread):
|
||||||
|
|
||||||
def check_matching_timezones(self, server_timezone):
|
def check_matching_timezones(self, server_timezone):
|
||||||
logger = logging.getLogger('fetch')
|
logger = logging.getLogger('fetch')
|
||||||
f = open('/etc/timezone', 'r')
|
|
||||||
pypo_timezone = f.readline().strip(' \t\n\r')
|
process = Popen(["date", "+%z"], stdout=PIPE)
|
||||||
f.close()
|
pypo_timezone = (process.communicate()[0]).strip(' \r\n\t')
|
||||||
|
|
||||||
if server_timezone != pypo_timezone:
|
if server_timezone != pypo_timezone:
|
||||||
logger.error("Server and pypo timezones do not match. Audio playback may not start when expected!")
|
logger.error("Server and pypo timezone offsets do not match. Audio playback may not start when expected!")
|
||||||
logger.error("Server timezone: %s", server_timezone)
|
logger.error("Server timezone offset: %s", server_timezone)
|
||||||
logger.error("Pypo timezone: %s", pypo_timezone)
|
logger.error("Pypo timezone offset: %s", pypo_timezone)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Process the schedule
|
Process the schedule
|
||||||
|
|
Loading…
Reference in New Issue