From f047b06ea71ce015eea5747cc5c04008f5bb948a Mon Sep 17 00:00:00 2001 From: San Jacobs Date: Mon, 22 May 2023 01:19:08 +0200 Subject: The beginning of timelines! --- src/time.odin | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/time.odin') diff --git a/src/time.odin b/src/time.odin index 700bed7..3bd4721 100644 --- a/src/time.odin +++ b/src/time.odin @@ -51,6 +51,7 @@ Workday :: struct { // because lunch breaks // cause more blocks blocks : [16]Timeblock, + fractions : [16]f32, total_timeblocks : int, } @@ -433,7 +434,7 @@ greatEq :: proc{greatEqMoment} diff :: proc(moment_a: Moment, moment_b: Moment) -> (acc: Delta) { - // TODO: Finish writing this + // FIXME: This seems to cause either infinite loops or crashes sometimes // Uses what I call an accumulator-decumulator design // Count how long it takes to approach a benchmark, @@ -629,6 +630,14 @@ hourcount :: proc(block: Timeblock) -> f32 { f32(days) * 24) } +daycount :: proc(delta: Delta) -> f32 { + using delta + assert(delta != {0,0,0}) + return f32(f32(minutes)/60/24 + + f32(hours)/24 + + f32(days) ) +} + days_in :: proc(month: int, year: int) -> int { switch month { case 1: -- cgit v1.2.1