From 9aa205ce5c606812ce5042a4a981fd73d44d45f0 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 30 Mar 2022 00:27:20 +0200 Subject: A lot more to do but it works for tonight --- src/u_utils.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/u_utils.go') 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 } -- cgit v1.2.3