From aa30ad678345e28afc7b7a5431844bd60424ef7e Mon Sep 17 00:00:00 2001
From: San Jacobs
Date: Sun, 21 May 2023 00:02:42 +0200
Subject: I have achieved procedure parity with the C++ version!

---
 src/main.odin |  2 +-
 src/time.odin | 28 +++++++++++++++++++---------
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/main.odin b/src/main.odin
index d64d5e3..fc7b7b8 100644
--- a/src/main.odin
+++ b/src/main.odin
@@ -37,7 +37,7 @@ test :: proc() {
 	block: Timeblock = {start, end, 0, ""}
 	fmt.println(toString(block))
 	
-	fmt.println(timeprint(block))
+	fmt.println(clockprint(block))
 	
 	
 	
diff --git a/src/time.odin b/src/time.odin
index a3e4b3b..2161239 100644
--- a/src/time.odin
+++ b/src/time.odin
@@ -183,7 +183,7 @@ new_workday :: proc(previous_wrap    : Moment,
 }
 
 lunch :: proc(workday: ^Workday, lunch_start: Moment, lunch_end: Moment) {
-	
+
 	//
 	//    This basically cuts out part of the workday
 	//
@@ -551,12 +551,6 @@ deltaToString :: proc(delta: Delta) -> (output: string) {
 	return
 }
 
-getweekday :: proc(moment: Moment) -> Weekday {
-	y: int = moment.year
-	t: []int = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 }
-	y -= int(moment.month < 3)
-	return Weekday((y + y / 4 - y / 100 + y / 400 + t[moment.month - 1] + moment.day - 1) % 7)
-}
 
 momentToString :: proc(moment: Moment) -> (output: string) {
 	using moment
@@ -583,9 +577,9 @@ clockprintMoment :: proc(moment: Moment) -> string {
 }
 clockprintTimeblock :: proc(block: Timeblock) -> string {
 	using block
-	return fmt.tprintf("%s -> %s", timeprint(start), timeprint(end))
+	return fmt.tprintf("%s -> %s", clockprint(start), clockprint(end))
 }
-timeprint :: proc{clockprintTimeblock, clockprintMoment}
+clockprint :: proc{clockprintTimeblock, clockprintMoment}
 
 popBlock :: proc(workday: ^Workday, index: int, count: int = 1) {
 	using workday
@@ -613,6 +607,22 @@ growBlocks :: proc(workday: ^Workday, index: int, count: int = 1) {
 	total_timeblocks += count
 }
 
+getweekday :: proc(moment: Moment) -> Weekday {
+	y: int = moment.year
+	t: []int = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 }
+	y -= int(moment.month < 3)
+	return Weekday((y + y / 4 - y / 100 + y / 400 + t[moment.month - 1] + moment.day - 1) % 7)
+}
+
+hourcount :: proc(block: Timeblock) -> f32 {
+	using block
+	delta: Delta = diff(end, start)
+	using delta
+	return f32(f32(minutes)/60 + 
+	           f32(hours) +
+	           f32(days) * 24)
+}
+
 days_in :: proc(month: int, year: int) -> int {
 	switch month {
 		case 1:
-- 
cgit v1.2.1