AceTime 3.0.0 Date and time classes for Arduino that support timezones from the TZ Database.

time_offset_mutation.h
Go to the documentation of this file.
1 /*
2 * MIT License
3 * Copyright (c) 2018 Brian T. Park
4 */
5
6 #ifndef ACE_TIME_TIME_OFFSET_MUTATION_H
7 #define ACE_TIME_TIME_OFFSET_MUTATION_H
8
9 #include <stdint.h>
10 #include "TimeOffset.h"
11
12 namespace ace_time {
13 namespace time_offset_mutation {
14
36 inline void increment15Minutes(TimeOffset& offset) {
37 int16_t minutes = offset.toMinutes() + 15;
38 if (minutes > 960) minutes = -960; // FIXME: This truncates to 15-minutes
39 offset.setMinutes(minutes);
40 }
41
42 }
43 }
44
45 #endif
ace_time::TimeOffset
A thin wrapper that represents a time offset from a reference point, usually 00:00 at UTC,...
Definition: TimeOffset.h:56
ace_time::TimeOffset::toMinutes
int16_t toMinutes() const
Return the time offset as minutes.
Definition: TimeOffset.h:128
ace_time::time_offset_mutation::increment15Minutes
void increment15Minutes(TimeOffset &offset)
Increment the TimeOffset by 15 minute interval.
Definition: time_offset_mutation.h:36