From 6f03e34d7af999226e3f1bc4410ce238542a9633 Mon Sep 17 00:00:00 2001 From: Aeluin Chen Date: Fri, 31 Mar 2017 11:39:11 +0800 Subject: [PATCH 1/5] fix: Sync time at startup --- systime/ntp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/systime/ntp.py b/systime/ntp.py index 2db4e06..2e3fd8f 100644 --- a/systime/ntp.py +++ b/systime/ntp.py @@ -40,6 +40,7 @@ def __init__(self, model): self._ntp_thread = Thread(target=self._ntp_update) self._ntp_thread.daemon = True if self.model.db["ntp"]["enable"] is True: + NtpDate(self.model.db["ntp"]["server"]) self.start() def update(self, config): From 222713870ee8ee1f0e98aa0361ffc169558e0dfe Mon Sep 17 00:00:00 2001 From: Aeluin Chen Date: Fri, 31 Mar 2017 11:40:22 +0800 Subject: [PATCH 2/5] 2.1.1 --- build-deb/debian/changelog | 6 ++++++ bundle.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/build-deb/debian/changelog b/build-deb/debian/changelog index ae84670..0b1dc96 100644 --- a/build-deb/debian/changelog +++ b/build-deb/debian/changelog @@ -1,3 +1,9 @@ +sanji-bundle-time (2.1.1-1) unstable; urgency=low + + * fix: Sync time at startup. + + -- Aeluin Chen Fri, 31 Mar 2017 11:39:38 +0800 + sanji-bundle-time (2.1.0-1) unstable; urgency=low * fix: Use "UTC" instead of local time. diff --git a/bundle.json b/bundle.json index 7eadb08..d3b8057 100644 --- a/bundle.json +++ b/bundle.json @@ -1,6 +1,6 @@ { "name": "time", - "version": "2.1.0", + "version": "2.1.1", "author": "Zack YL Shih", "email": "ZackYL.Shih@moxa.com", "description": "Provides the system-time management function", From 9163447206f9a0cd905eb54c12c052790eb7a4f2 Mon Sep 17 00:00:00 2001 From: Aeluin Chen Date: Thu, 20 Apr 2017 23:59:54 +0800 Subject: [PATCH 3/5] fix: Update time with seconds & ns --- systime/systime.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/systime/systime.py b/systime/systime.py index 4eb9a42..dd166a0 100644 --- a/systime/systime.py +++ b/systime/systime.py @@ -26,16 +26,14 @@ def set_system_time(time_string): """ rc = None try: - dateTimeString = datetime\ - .strptime(time_string, "%Y-%m-%dT%H:%M:%S.%fZ")\ - .strftime("%m%d%H%M%Y") + datetime.strptime(time_string, "%Y-%m-%dT%H:%M:%S.%fZ") except ValueError: raise ValueError('Time format error.') else: rc = subprocess.call( - "date --utc %s; hwclock -w" % dateTimeString, shell=True) + "date --set=\"%s\"; hwclock -w" % time_string, shell=True) return True if rc == 0 else False From 1e9e07aa447972fe43b5b9e30716110043ee431b Mon Sep 17 00:00:00 2001 From: Aeluin Chen Date: Fri, 21 Apr 2017 00:09:42 +0800 Subject: [PATCH 4/5] test: Fix unittest --- tests/test_systime/test_systime.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_systime/test_systime.py b/tests/test_systime/test_systime.py index e6bac1b..67f052e 100644 --- a/tests/test_systime/test_systime.py +++ b/tests/test_systime/test_systime.py @@ -31,10 +31,9 @@ def test_set_system_time(self): # case 1: command success subprocess.call.return_value = 0 t = "2015-03-26T16:27:48.611441Z" - ans_t = "032616272015" self.assertTrue(SysTime.set_system_time(t)) subprocess.call.assert_called_with( - "date --utc %s; hwclock -w" % ans_t, shell=True) + "date --set=\"%s\"; hwclock -w" % t, shell=True) # case 2: command failed subprocess.call.return_value = 1 From f51835771edd899cc580ef9a1a611a8572faf635 Mon Sep 17 00:00:00 2001 From: Aeluin Chen Date: Fri, 21 Apr 2017 00:02:30 +0800 Subject: [PATCH 5/5] 2.1.2 --- build-deb/debian/changelog | 6 ++++++ bundle.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/build-deb/debian/changelog b/build-deb/debian/changelog index 0b1dc96..376666b 100644 --- a/build-deb/debian/changelog +++ b/build-deb/debian/changelog @@ -1,3 +1,9 @@ +sanji-bundle-time (2.1.2-1) unstable; urgency=low + + * fix: Update time with seconds & ns. + + -- Aeluin Chen Fri, 21 Apr 2017 00:01:15 +0800 + sanji-bundle-time (2.1.1-1) unstable; urgency=low * fix: Sync time at startup. diff --git a/bundle.json b/bundle.json index d3b8057..862bff0 100644 --- a/bundle.json +++ b/bundle.json @@ -1,6 +1,6 @@ { "name": "time", - "version": "2.1.1", + "version": "2.1.2", "author": "Zack YL Shih", "email": "ZackYL.Shih@moxa.com", "description": "Provides the system-time management function",