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

Unified Diff: client/bin/base_utils.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 | « no previous file | client/common_lib/rtc.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/bin/base_utils.py
diff --git a/client/bin/base_utils.py b/client/bin/base_utils.py
index fe1c9387809115c10d89cfd7fb1410c06e0b9502..f1b1de676be62d337b8a75a63152cf366e3dd991 100644
--- a/client/bin/base_utils.py
+++ b/client/bin/base_utils.py
@@ -741,60 +741,3 @@ def process_is_alive(name_pattern):
ignore_status=True) == 0
-def get_hwclock_seconds(utc=True):
- """
- Return the hardware clock in seconds as a floating point value.
- Use Coordinated Universal Time if utc is True, local time otherwise.
- Raise a ValueError if unable to read the hardware clock.
- """
- cmd = '/sbin/hwclock --debug'
- if utc:
- cmd += ' --utc'
- hwclock_output = utils.system_output(cmd, ignore_status=True)
- match = re.search(r'= ([0-9]+) seconds since .+ (-?[0-9.]+) seconds$',
- hwclock_output, re.DOTALL)
- if match:
- seconds = int(match.group(1)) + float(match.group(2))
- logging.debug('hwclock seconds = %f' % seconds)
- return seconds
-
- raise ValueError('Unable to read the hardware clock -- ' +
- hwclock_output)
-
-
-def set_wake_alarm(alarm_time):
- """
- Set the hardware RTC-based wake alarm to 'alarm_time'.
- """
- utils.write_one_line('/sys/class/rtc/rtc0/wakealarm', str(alarm_time))
-
-
-def set_power_state(state):
- """
- Set the system power state to 'state'.
- """
- utils.write_one_line('/sys/power/state', state)
-
-
-def standby():
- """
- Power-on suspend (S1)
- """
- set_power_state('standby')
-
-
-def suspend_to_ram():
- """
- Suspend the system to RAM (S3)
- """
- if os.path.exists('/usr/bin/powerd_suspend'):
- utils.system('/usr/bin/powerd_suspend')
- else:
- set_power_state('mem')
-
-
-def suspend_to_disk():
- """
- Suspend the system to disk (S4)
- """
- set_power_state('disk')
« no previous file with comments | « no previous file | client/common_lib/rtc.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698