AceTime  3.0.0
Date and time classes for Arduino that support timezones from the TZ Database.
Functions
offset_date_time_mutation.h File Reference

Methods that mutate an OffsetDateTime object. More...

#include <stdint.h>
#include <AceCommon.h>
#include "OffsetDateTime.h"
Include dependency graph for offset_date_time_mutation.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void ace_time::offset_date_time_mutation::incrementYear (OffsetDateTime &dateTime)
 Increment the year by one within the interval [2000, 2099].
 
void ace_time::offset_date_time_mutation::incrementMonth (OffsetDateTime &dateTime)
 Increment the month by one within the interval [1, 12].
 
void ace_time::offset_date_time_mutation::incrementDay (OffsetDateTime &dateTime)
 Increment the day by one within the interval [1, 31].
 
void ace_time::offset_date_time_mutation::incrementHour (OffsetDateTime &dateTime)
 Increment the hour by one within the interval [0, 23].
 
void ace_time::offset_date_time_mutation::incrementMinute (OffsetDateTime &dateTime)
 Increment the minute by one within the interval [0, 59].
 

Detailed Description

Methods that mutate an OffsetDateTime object.

The number of mutation methods of a OffsetDateTime object is basically unlimited, so including them in the OffsetDateTime class would make its API too complex and always incomplete. By extracting them into a separate namespace, we limit the complexity of the OffsetDateTime class and allow additional mutation methods to be added to this namespace by downstream applications.

No validation is performed during the mutation operation. Client code is normally expected to call the toEpochSeconds() method to convert this into an acetime_t, then later convert it back to human-readable components using the forEpochSeconds() factory method.

Example:

OffsetDateTime dt(...);
offset_date_time_mutation::incrementDay(dt);

Definition in file offset_date_time_mutation.h.