Skip to content

Commit

Permalink
fix : sync parameter added to wakeup function #48
Browse files Browse the repository at this point in the history
  • Loading branch information
sepandhaghighi committed Dec 27, 2020
1 parent e37d254 commit 420540c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion orangetool/orangetool_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def version():
tprint("v" + ORANGETOOL_VERSION, font="bulbhead")


def wakeup(day=0, hour=0, minute=0, debug=False):
def wakeup(day=0, hour=0, minute=0, sync=True, debug=False):
"""
Set wakeup time for kernel RTC (need sudo).
Expand All @@ -118,11 +118,15 @@ def wakeup(day=0, hour=0, minute=0, debug=False):
:type hour:int
:param minute: minute for wakeup
:type minute:int
:param sync: RTC sync flag
:type sync: bool
:param debug: flag for using debug mode
:type debug:bool
:return: bool
"""
try:
if sync:
_ = sub.Popen("hwclock -w",stderr=sub.PIPE,stdout=sub.PIPE,stdin=sub.PIPE)
total_time = day * 24 * 60 + hour * 60 + minute
epoch = time.time() + total_time * 60
file = open("/sys/class/rtc/rtc0/wakealarm", "w")
Expand Down

0 comments on commit 420540c

Please sign in to comment.