summaryrefslogtreecommitdiff
path: root/notes/time_calculations.txt
blob: d623026e0810f11cbe23d8d2b4bfc40891c4e30d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
time is always 4 digits longs with a colon seperating hour and minutes:
minutes are directly correlated in both times, no conversion needed (right two digits)
remove colon from number
add any leading 0s as necessary to fit 4 spaces: XXXX (04:43 AM -> 0443) (done in a later printf) (for now, 443)


12 AM - 12:59 AM       	= just add the minutes


1:00 AM - 12:59 PM 	= add the minutes and add (100 * number left of colon) (Example 3:42 AM -> (42 + (3 * 100)) => 342)
(another example: 12:16 PM -> (16 + (12 * 100) => 1216)


1 PM - 11:59 PM 	= add the minutes and add ((12 + number left of colon) * 100)
example: 3:33 PM -> 33 + (3 + 12) * 100 => 1533


longest string = 12:12 PM - 12:12 AM (19 characters)
shortest string = 1 AM - 2 PM (11 characters)