From f48a329886f863cf22ab670fb3bd059ec6fadb25 Mon Sep 17 00:00:00 2001 From: Siarhei Siniak Date: Tue, 13 Dec 2022 21:22:12 +0300 Subject: [PATCH] [~] Refactor --- dotfiles/.local/bin/commands | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dotfiles/.local/bin/commands b/dotfiles/.local/bin/commands index c9ca2f7..3c6dc90 100755 --- a/dotfiles/.local/bin/commands +++ b/dotfiles/.local/bin/commands @@ -1142,10 +1142,16 @@ def suspend_timer(argv): if ((t1.hour, t1.minute) >= (t2.hour, t2.minute)): break else: + t3 = [ + (t2.hour - t1.hour), + t2.minute - t1.minute + ] + if t3[1] < 0: + t3[1] += 60 + t3[0] -= 1 print("\r%s, %02d:%02d" % ( t1, - (t2.hour - t1.hour), - (t2.minute - t1.minute + 60) % 60, + *t3, ), end="") time.sleep(1) print("suspend computer at %s" % t1.isoformat())