summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authorvchigrin@yandex-team.ru <vchigrin@yandex-team.ru@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-02 11:44:07 +0000
committervchigrin@yandex-team.ru <vchigrin@yandex-team.ru@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-02 11:44:07 +0000
commitc672787769427ec47024f9f0929c756d9783790b (patch)
tree989f5e6d197b4e1e4f8d1f1f859f8ef8856b8c67 /sync
parentffd36a72e5613f2746fdb96554312c6582c51c23 (diff)
downloadchromium_src-c672787769427ec47024f9f0929c756d9783790b.zip
chromium_src-c672787769427ec47024f9f0929c756d9783790b.tar.gz
chromium_src-c672787769427ec47024f9f0929c756d9783790b.tar.bz2
Fix chromium sync server for timezones with positive UTC offset.
TEST=Set timezone to Moscow, Russia, then run sync_integration_tests. Review URL: https://chromiumcodereview.appspot.com/23834002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220831 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/tools/testserver/chromiumsync.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/sync/tools/testserver/chromiumsync.py b/sync/tools/testserver/chromiumsync.py
index 834765f..b95c6be 100644
--- a/sync/tools/testserver/chromiumsync.py
+++ b/sync/tools/testserver/chromiumsync.py
@@ -122,9 +122,13 @@ SYNC_TYPE_TO_DESCRIPTOR = {
# The parent ID used to indicate a top-level node.
ROOT_ID = '0'
-# Unix time epoch in struct_time format. The tuple corresponds to UTC Wednesday
-# Jan 1 1970, 00:00:00, non-dst.
-UNIX_TIME_EPOCH = (1970, 1, 1, 0, 0, 0, 3, 1, 0)
+# Unix time epoch +1 day in struct_time format. The tuple corresponds to
+# UTC Thursday Jan 2 1970, 00:00:00, non-dst.
+# We have to add one day after start of epoch, since in timezones with positive
+# UTC offset time.mktime throws an OverflowError,
+# rather then returning negative number.
+FIRST_DAY_UNIX_TIME_EPOCH = (1970, 1, 2, 0, 0, 0, 4, 2, 0)
+ONE_DAY_SECONDS = 60 * 60 * 24
# The number of characters in the server-generated encryption key.
KEYSTORE_KEY_LENGTH = 16
@@ -984,7 +988,7 @@ class SyncDataModel(object):
# Store the current time since the Unix epoch in milliseconds.
entry.mtime = (int((time.mktime(time.gmtime()) -
- time.mktime(UNIX_TIME_EPOCH))*1000))
+ (time.mktime(FIRST_DAY_UNIX_TIME_EPOCH) - ONE_DAY_SECONDS))*1000))
# Commit the change. This also updates the version number.
self._SaveEntry(entry)