aboutsummaryrefslogtreecommitdiff
path: root/src/time.odin
diff options
context:
space:
mode:
Diffstat (limited to 'src/time.odin')
-rw-r--r--src/time.odin11
1 files changed, 10 insertions, 1 deletions
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: