Skip to content

Commit

Permalink
Merge pull request #26 from Sanji-IO/release/uc-8100-lx-cg_v1.1
Browse files Browse the repository at this point in the history
Release/uc 8100 lx cg v1.1
  • Loading branch information
imZack committed Mar 22, 2016
2 parents a110d34 + d373dbd commit a463889
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
6 changes: 6 additions & 0 deletions build-deb/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
sanji-bundle-time (0.9.4-1) unstable; urgency=low

* Sync to RTC while using NTP.

-- Aeluin Chen <[email protected]> Fri, 20 Nov 2015 13:50:48 +0800

sanji-bundle-time (0.9.3-1) unstable; urgency=low

* build-deb/ added for building Debian package.
Expand Down
2 changes: 1 addition & 1 deletion bundle.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "time",
"version": "0.9.3",
"version": "0.9.4",
"author": "Zack YL Shih",
"email": "[email protected]",
"description": "System time management.",
Expand Down
7 changes: 7 additions & 0 deletions systime/ntp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ def NtpDate(server):
rc = subprocess.call(["ntpdate", server])
_logger.debug("NTP update %s." % "successfully"
if rc == 0 else "failed")
if rc != 0:
return rc

# Sync to RTC
rc = subprocess.call("hwclock -w", shell=True)
if rc == 0:
_logger.debug("Failed to sync to RTC")

return rc

Expand Down
4 changes: 2 additions & 2 deletions tests/test_systime/test_ntp.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ def test_NtpDate(self):
with patch("systime.ntp.subprocess") as subprocess:
subprocess.call.return_value = 0
NtpDate(server)
subprocess.call.assert_called_once_with(["ntpdate", server])
subprocess.call.assert_any_call("hwclock -w", shell=True)

subprocess.call.reset_mock()
subprocess.call.return_value = 1
NtpDate(server)
subprocess.call.assert_called_once_with(["ntpdate", server])
subprocess.call.assert_any_call(["ntpdate", server])


class TestNtpClass(unittest.TestCase):
Expand Down

0 comments on commit a463889

Please sign in to comment.