aboutsummaryrefslogtreecommitdiff
path: root/src/time.odin
diff options
context:
space:
mode:
Diffstat (limited to 'src/time.odin')
-rw-r--r--src/time.odin28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/time.odin b/src/time.odin
index a3e4b3b..2161239 100644
--- a/src/time.odin
+++ b/src/time.odin
@@ -183,7 +183,7 @@ new_workday :: proc(previous_wrap : Moment,
}
lunch :: proc(workday: ^Workday, lunch_start: Moment, lunch_end: Moment) {
-
+
//
// This basically cuts out part of the workday
//
@@ -551,12 +551,6 @@ deltaToString :: proc(delta: Delta) -> (output: string) {
return
}
-getweekday :: proc(moment: Moment) -> Weekday {
- y: int = moment.year
- t: []int = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 }
- y -= int(moment.month < 3)
- return Weekday((y + y / 4 - y / 100 + y / 400 + t[moment.month - 1] + moment.day - 1) % 7)
-}
momentToString :: proc(moment: Moment) -> (output: string) {
using moment
@@ -583,9 +577,9 @@ clockprintMoment :: proc(moment: Moment) -> string {
}
clockprintTimeblock :: proc(block: Timeblock) -> string {
using block
- return fmt.tprintf("%s -> %s", timeprint(start), timeprint(end))
+ return fmt.tprintf("%s -> %s", clockprint(start), clockprint(end))
}
-timeprint :: proc{clockprintTimeblock, clockprintMoment}
+clockprint :: proc{clockprintTimeblock, clockprintMoment}
popBlock :: proc(workday: ^Workday, index: int, count: int = 1) {
using workday
@@ -613,6 +607,22 @@ growBlocks :: proc(workday: ^Workday, index: int, count: int = 1) {
total_timeblocks += count
}
+getweekday :: proc(moment: Moment) -> Weekday {
+ y: int = moment.year
+ t: []int = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 }
+ y -= int(moment.month < 3)
+ return Weekday((y + y / 4 - y / 100 + y / 400 + t[moment.month - 1] + moment.day - 1) % 7)
+}
+
+hourcount :: proc(block: Timeblock) -> f32 {
+ using block
+ delta: Delta = diff(end, start)
+ using delta
+ return f32(f32(minutes)/60 +
+ f32(hours) +
+ f32(days) * 24)
+}
+
days_in :: proc(month: int, year: int) -> int {
switch month {
case 1: