Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: client/common_lib/rtc.py

Issue 3516004: Exported utility functions for RTC and system sleep (Closed) Base URL: ssh://gitrw.chromium.org/autotest.git
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/bin/base_utils.py ('k') | client/common_lib/sys_power.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/common_lib/rtc.py
diff --git a/client/common_lib/rtc.py b/client/common_lib/rtc.py
new file mode 100644
index 0000000000000000000000000000000000000000..ac2319547c978c59ea18b06609156ab41ff7e50b
--- /dev/null
+++ b/client/common_lib/rtc.py
@@ -0,0 +1,14 @@
+def get_seconds(utc=True):
+ """
+ Read the current time out of the RTC
+ """
+ return int(file('/sys/class/rtc/rtc0/since_epoch').readline())
+
+
+def set_wake_alarm(alarm_time):
+ """
+ Set the hardware RTC-based wake alarm to 'alarm_time'.
+ """
+ file('/sys/class/rtc/rtc0/wakealarm', 'w').write("%s\n" % str(alarm_time))
+
+
« no previous file with comments | « client/bin/base_utils.py ('k') | client/common_lib/sys_power.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698