AceTime  0.3
Date and time classes for Arduino that support timezones from the TZ Database, and a system clock that can synchronize from an NTP server or an RTC chip.
time_period_mutation.h
1 #ifndef ACE_TIME_TIME_PERIOD_MUTATION_H
2 #define ACE_TIME_TIME_PERIOD_MUTATION_H
3 
4 #include <stdint.h>
5 #include "common/util.h"
6 #include "TimePeriod.h"
7 
8 namespace ace_time {
9 namespace time_period_mutation {
10 
23 inline void negate(TimePeriod& period) {
24  period.sign(-period.sign());
25 }
26 
28 inline void incrementHour(TimePeriod& period, uint8_t limit) {
29  uint8_t hour = period.hour();
30  common::incrementMod(hour, limit);
31  period.hour(hour);
32 }
33 
35 inline void incrementHour(TimePeriod& period) {
36  incrementHour(period, (uint8_t) 24);
37 }
38 
40 inline void incrementMinute(TimePeriod& period) {
41  uint8_t minute = period.minute();
42  common::incrementMod(minute, (uint8_t) 60);
43  period.minute(minute);
44 }
45 
46 
47 }
48 }
49 
50 #endif