summaryrefslogtreecommitdiff
path: root/main.odin
blob: da72be7b89c46b2955ecd90100af2ce644a9bfd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main

import "core:fmt"
import "core:os"

dayrate : f64 = 3500

main :: proc() {
	
	arg_count := len(os.args)-1
	
	total_hours : f64 = 0;
	for i in 1..=arg_count {
		
		fmt.printf("%d: ", i)
		
		timeblocks, ok := importICS(os.args[i])
		
		if ok {
			hours : f64 = 0
			for each_block in timeblocks {
				hours += f64(hourcount(each_block))
			}
			minutes := int(f64(hours-f64(int(hours)))*60.0)
			fmt.println(os.args[i])
			fmt.printf("     Hour count: %f\nHours & Minutes: %02d:%02d\n\n",
				       hours, int(hours), minutes)
			total_hours += hours
		} else {
			// Noffin i guess
			fmt.printf("\n\n")
		}
	}
	
	fmt.printf("\nTOTAL\n\n")
	
	total_final_hour_fraction : f64 = total_hours - f64(int(total_hours));
	
	total_minutes := int(total_final_hour_fraction*60.0)
	
	fmt.printf("     Hour count: %f\nHours & Minutes: %02d:%02d\n",
		       total_hours, int(total_hours), total_minutes)
	
	return
}