From b8d343e0ded8b39eee8a8295675a26c7677ac319 Mon Sep 17 00:00:00 2001 From: San Jacobs Date: Tue, 5 Nov 2024 14:36:54 +0100 Subject: Init --- main.odin | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 main.odin (limited to 'main.odin') diff --git a/main.odin b/main.odin new file mode 100644 index 0000000..da72be7 --- /dev/null +++ b/main.odin @@ -0,0 +1,45 @@ +package main + +import "core:fmt" +import "core:os" + +dayrate : f64 = 3500 + +main :: proc() { + + arg_count := len(os.args)-1 + + total_hours : f64 = 0; + for i in 1..=arg_count { + + fmt.printf("%d: ", i) + + timeblocks, ok := importICS(os.args[i]) + + if ok { + hours : f64 = 0 + for each_block in timeblocks { + hours += f64(hourcount(each_block)) + } + minutes := int(f64(hours-f64(int(hours)))*60.0) + fmt.println(os.args[i]) + fmt.printf(" Hour count: %f\nHours & Minutes: %02d:%02d\n\n", + hours, int(hours), minutes) + total_hours += hours + } else { + // Noffin i guess + fmt.printf("\n\n") + } + } + + fmt.printf("\nTOTAL\n\n") + + total_final_hour_fraction : f64 = total_hours - f64(int(total_hours)); + + total_minutes := int(total_final_hour_fraction*60.0) + + fmt.printf(" Hour count: %f\nHours & Minutes: %02d:%02d\n", + total_hours, int(total_hours), total_minutes) + + return +} -- cgit v1.2.1