diff options
author | San Jacobs | 2023-05-22 01:19:08 +0200 |
---|---|---|
committer | San Jacobs | 2023-05-22 01:19:08 +0200 |
commit | f047b06ea71ce015eea5747cc5c04008f5bb948a (patch) | |
tree | e54f7aad11ec1b04e170e5d23f29edb3da5465c5 /src/time.odin | |
parent | 56ea120ff460aa072da30c30e70bdbd5fd71ba8d (diff) | |
download | satscalc-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.odin | 11 |
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: |