diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2022-03-30 00:27:20 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2022-03-30 00:27:20 +0200 |
commit | 9aa205ce5c606812ce5042a4a981fd73d44d45f0 (patch) | |
tree | 998311cd7adb6d437ed9b00ed18e485eb5b4fc03 /src/u_prints.go | |
parent | In progress (diff) | |
download | go2work-9aa205ce5c606812ce5042a4a981fd73d44d45f0.tar.gz go2work-9aa205ce5c606812ce5042a4a981fd73d44d45f0.tar.bz2 go2work-9aa205ce5c606812ce5042a4a981fd73d44d45f0.tar.xz go2work-9aa205ce5c606812ce5042a4a981fd73d44d45f0.tar.zst go2work-9aa205ce5c606812ce5042a4a981fd73d44d45f0.zip |
A lot more to do but it works for tonight
Diffstat (limited to 'src/u_prints.go')
-rw-r--r-- | src/u_prints.go | 64 |
1 files changed, 38 insertions, 26 deletions
diff --git a/src/u_prints.go b/src/u_prints.go index 6233763..64851dd 100644 --- a/src/u_prints.go +++ b/src/u_prints.go @@ -56,37 +56,49 @@ func print_time(t [3]byte) { } func print_time_left(curr_t [3]byte, dest_t [3]byte) { + var left_secs uint curr_secs := time_to_seconds(curr_t) dest_secs := time_to_seconds(dest_t) - left_secs := curr_secs - dest_secs - fmt.Println("left_secs: [", left_secs, "]") - // left_t := seconds_to_time(left_secs) - // if left_secs < 60 { - // fmt.Print( - // "\r", - // left_t[SECS], "s", - // " left to sleep", - // ) - // } else if left_secs < 3600 { - // fmt.Print( - // "\r", - // left_t[MINS], "m ", - // left_t[SECS], "s", - // " left to sleep", - // ) - // } else { - // fmt.Print( - // "\r", - // left_t[HOURS], "h ", - // left_t[MINS], "m ", - // left_t[SECS], "s", - // " left to sleep", - // ) - // } + if curr_secs <= dest_secs { + left_secs = dest_secs - curr_secs + } else { + left_secs = (dest_secs + (24 * 3600)) - curr_secs + } + left_t := seconds_to_time(left_secs) + if left_secs < 60 { + fmt.Print("\r ") + fmt.Print( + "\r", + left_t[SECS], "s", + " left to sleep", + ) + } else if left_secs < 3600 { + fmt.Print( + "\r", + left_t[MINS], "m ", + left_t[SECS], "s", + " left to sleep", + ) + } else { + fmt.Print( + "\r", + left_t[HOURS], "h ", + left_t[MINS], "m ", + left_t[SECS], "s", + " left to sleep", + ) + } } func print_help() { - fmt.Println("help") + fmt.Println("Usage: + go2work [option / time] + +Options: + -h show this help menu + -H show the real help menu + -v show version of go2work + ") } func print_real_help() { |