aboutsummaryrefslogtreecommitdiff
path: root/src/time.odin
diff options
context:
space:
mode:
authorSan Jacobs2023-05-22 01:19:08 +0200
committerSan Jacobs2023-05-22 01:19:08 +0200
commitf047b06ea71ce015eea5747cc5c04008f5bb948a (patch)
treee54f7aad11ec1b04e170e5d23f29edb3da5465c5 /src/time.odin
parent56ea120ff460aa072da30c30e70bdbd5fd71ba8d (diff)
downloadsatscalc-f047b06ea71ce015eea5747cc5c04008f5bb948a.tar.gz
satscalc-f047b06ea71ce015eea5747cc5c04008f5bb948a.tar.bz2
satscalc-f047b06ea71ce015eea5747cc5c04008f5bb948a.zip
The beginning of timelines!
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: