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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
#pragma once
#include <iostream>
#include <sstream>
#include <ios>
#include <iomanip>
#include <string.h>
#include <vector>
enum weekday{
monday,
tuesday,
wednesday,
thursday,
friday,
saturday,
sunday
};
struct delta{
unsigned int minutes;
unsigned int hours;
unsigned int days;
};
std::ostream& operator<<(std::ostream& stream, const delta& other);
struct moment{
signed int minutes;
signed int hours; // 24-hour format. 23:59 progresses to 00:00
signed int day;
signed int month;
signed int year;
weekday getweekday();
bool operator<(const moment& other) const;
bool operator>(const moment& other) const;
bool operator==(const moment& other) const;
bool operator!=(const moment& other) const;
delta operator-(const moment& other) const;
moment operator+(const delta& other) const;
moment operator-(const delta& other) const;
};
struct timeblock{
moment start;
moment end;
double hourcount();
float valuefactor = 1;
};
struct workday{
moment call;
moment wrap;
moment planned_wrap;
timeblock blocks[14];
//
// 1. call
// 2. sleepbreach
// 3. 6:00
// 4. started 2 hours before 7
// 5. 1st hr overtime
// 6. post-1 hour overtime
// 7. end of warned ot
// 8. 14-hour mark
// 9. 22:00
// 10. midnight crossing
// 11. 06:00
// 12. wrap
//
workday(const moment& previous_wrap,
const moment& calltime,
const moment& wraptime,
const moment& planned_wraptime);
};
std::string padint(const int input, const int minimum_signs);
timeblock timesplit(timeblock& input_block, const moment splitpoint);
// XXX: I have now found that it would be really nice if the first half is returned,
// and the second half replaces the instance at input_block;
// Splits a timeblock at splitpoint.
// It changes the input_block to end at splitpoint, and returns a new timeblock
// that lasts from splitpoint to where the input_block used to end.
void wind(moment& input_moment, const int minutes, const int hours, const int days);
void wind(moment& input_moment, const delta& time_delta);
int days_in(const int month, const int year);
std::string timeprint(const moment input_moment);
std::string timeprint(const timeblock input_timeblock);
long sortable_time(const timeblock input_timeblock);
moment timeinput(const int or_year, const int or_month, const int or_day);
moment timeinput();
// TODO: It would be nice to have a version that can take in a const reference to a moment, prompt for clock-time, and return the first moment at that clock-time forward in time from the input moment
|