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:
martin 2011-03-23 22:14:57 -04:00
parent 36a68aa589
commit 8a2610aa84
2 changed files with 9 additions and 7 deletions

View File

@ -716,7 +716,7 @@ class Schedule {
$result['stream_metadata'] = array();
$result['stream_metadata']['format'] = Application_Model_Preference::GetStreamLabelFormat();
$result['stream_metadata']['station_name'] = Application_Model_Preference::GetStationName();
$result['server_timezone'] = date_default_timezone_get();
$result['server_timezone'] = date('O');
return $result;
}

View File

@ -11,6 +11,7 @@ import json
import telnetlib
import math
from threading import Thread
from subprocess import Popen, PIPE
# For RabbitMQ
from kombu.connection import BrokerConnection
@ -78,13 +79,14 @@ class PypoFetch(Thread):
def check_matching_timezones(self, server_timezone):
logger = logging.getLogger('fetch')
f = open('/etc/timezone', 'r')
pypo_timezone = f.readline().strip(' \t\n\r')
f.close()
process = Popen(["date", "+%z"], stdout=PIPE)
pypo_timezone = (process.communicate()[0]).strip(' \r\n\t')
if server_timezone != pypo_timezone:
logger.error("Server and pypo timezones do not match. Audio playback may not start when expected!")
logger.error("Server timezone: %s", server_timezone)
logger.error("Pypo timezone: %s", pypo_timezone)
logger.error("Server and pypo timezone offsets do not match. Audio playback may not start when expected!")
logger.error("Server timezone offset: %s", server_timezone)
logger.error("Pypo timezone offset: %s", pypo_timezone)
"""
Process the schedule