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_utils.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_utils.go')
-rw-r--r-- | src/u_utils.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/u_utils.go b/src/u_utils.go index a0c5008..598efed 100644 --- a/src/u_utils.go +++ b/src/u_utils.go @@ -39,14 +39,25 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * go2work: src/u_utils.go - * Tue Mar 29 22:32:20 CEST 2022 + * Wed Mar 30 00:02:25 CEST 2022 * Joe */ package main -func time_to_seconds(time [3]byte) uint16 { +func time_to_seconds(time [3]byte) uint { + return (3600 * uint(time[HOURS])) + + (60 * uint(time[MINS])) + + uint(time[SECS]) } -func seconds_to_time(seconds uint16) [3]byte { +func seconds_to_time(seconds uint) [3]byte { + var time [3]byte + var hours, mins uint + hours = seconds / 3600 + time[HOURS] = byte(hours) + mins = (seconds - ((hours) * 3600)) / 60 + time[MINS] = byte(mins) + time[SECS] = byte((seconds - (hours * 3600)) - mins * 60) + return time } |