Dataflow Runtime API
3.1.1.0
|
Class to access date and time information. More...
#include <Imt.Base.Core.Util/DateTimeStamp.h>
Public Member Functions | |
DateTimeStamp (const uint16_t year=0U, const uint8_t month=1U, const uint8_t day=1U, const uint8_t hour=0U, const uint8_t minute=0U, const uint8_t second=0U) | |
Constructor for DateTimeStamps with full date and time information. More... | |
DateTimeStamp (const DateTimeStamp &source) | |
Copy constructor. More... | |
virtual | ~DateTimeStamp (void) |
Destructor. More... | |
bool | operator== (const DateTimeStamp &other) const |
Equals operator overload. More... | |
bool | operator!= (const DateTimeStamp &other) const |
Not equals operator overload. More... | |
bool | operator> (const DateTimeStamp &other) const |
Greater than operator overload. More... | |
bool | operator< (const DateTimeStamp &other) const |
Less than operator overload. More... | |
bool | operator>= (const DateTimeStamp &other) const |
Greater than or equal operator overload. More... | |
bool | operator<= (const DateTimeStamp &other) const |
Less than or equal operator overload. More... | |
DateTimeStamp & | operator= (const DateTimeStamp &source) |
Assignment operator. More... | |
void | addDays (const uint32_t days) |
Adds the given amount of days to the timestamp. More... | |
void | addHours (const uint32_t hours) |
Adds the given amount of days to the timestamp. More... | |
void | addMinutes (const uint32_t minutes) |
Adds the given amount of days to the timestamp. More... | |
void | addSeconds (const uint32_t seconds) |
Adds the given amount of seconds to the timestamp. More... | |
uint16_t | getYear (void) const |
Returns the current year. More... | |
uint16_t | getYearShort (void) const |
Returns the current year - the last two digits. More... | |
void | setYear (const uint16_t year) |
Sets the year. More... | |
uint8_t | getMonth (void) const |
Returns the current month. More... | |
void | setMonth (const uint8_t month) |
Sets the month. More... | |
uint8_t | getDay (void) const |
Returns the current day. More... | |
void | setDay (const uint8_t day) |
Sets the day. More... | |
uint8_t | getHour (void) const |
Returns the current hour. More... | |
void | setHour (const uint8_t hour) |
Sets the hour. More... | |
uint8_t | getMinute (void) const |
Returns the current minute. More... | |
void | setMinute (const uint8_t minute) |
Sets the minute. More... | |
uint8_t | getSecond (void) const |
Returns the current second. More... | |
void | setSecond (const uint8_t second) |
Sets the second. More... | |
void | subtractDays (const uint32_t days) |
Subtracts the given amount of days from the timestamp. More... | |
void | subtractHours (const uint32_t hours) |
Subtracts the given amount of days from the timestamp. More... | |
void | subtractMinutes (const uint32_t minutes) |
Subtracts the given amount of days from the timestamp. More... | |
void | subtractSeconds (const uint32_t seconds) |
Subtracts the given amount of seconds from the timestamp. More... | |
Static Public Member Functions | |
static uint8_t | getNumberOfDaysOfMonth (const uint8_t month, const uint16_t year) |
Gets the number of days of the given month. More... | |
static bool | isLeapYear (const uint16_t year) |
Returns true if the given year is a leap year. More... | |
static uint32_t | getDifferenceDays (const DateTimeStamp &date1, const DateTimeStamp &date2) |
Calculates the difference in days of two DateTimeStamps. More... | |
Class to access date and time information.
|
explicit |
Constructor for DateTimeStamps with full date and time information.
Default initialization: year = 0U, month = 1U, day = 1U, hour = 0U, minute = 0U, second = 0U
year | The current year. |
month | The current month. |
day | The current day. |
hour | The current hour. |
minute | The current minute. |
second | The current second. |
imt::base::core::util::DateTimeStamp::DateTimeStamp | ( | const DateTimeStamp & | source | ) |
Copy constructor.
source | Other DateTimeStamp object to copy. |
|
virtual |
Destructor.
void imt::base::core::util::DateTimeStamp::addDays | ( | const uint32_t | days | ) |
Adds the given amount of days to the timestamp.
days | The days to add. |
void imt::base::core::util::DateTimeStamp::addHours | ( | const uint32_t | hours | ) |
Adds the given amount of days to the timestamp.
hours | The hours to add. |
void imt::base::core::util::DateTimeStamp::addMinutes | ( | const uint32_t | minutes | ) |
Adds the given amount of days to the timestamp.
minutes | The minutes to add. |
void imt::base::core::util::DateTimeStamp::addSeconds | ( | const uint32_t | seconds | ) |
Adds the given amount of seconds to the timestamp.
seconds | The seconds to add. |
uint8_t imt::base::core::util::DateTimeStamp::getDay | ( | void | ) | const |
Returns the current day.
|
static |
Calculates the difference in days of two DateTimeStamps.
The time is not used. E.g.: 17.12.2011 20:10 - 4.8.2010 21:27 = 500 days
date1 | Date 1. |
date2 | Date 2. |
uint8_t imt::base::core::util::DateTimeStamp::getHour | ( | void | ) | const |
Returns the current hour.
uint8_t imt::base::core::util::DateTimeStamp::getMinute | ( | void | ) | const |
Returns the current minute.
uint8_t imt::base::core::util::DateTimeStamp::getMonth | ( | void | ) | const |
Returns the current month.
|
static |
Gets the number of days of the given month.
month | The month of which the number of days is requested. |
year | The year of which the number of days per month is requested. |
uint8_t imt::base::core::util::DateTimeStamp::getSecond | ( | void | ) | const |
Returns the current second.
uint16_t imt::base::core::util::DateTimeStamp::getYear | ( | void | ) | const |
Returns the current year.
uint16_t imt::base::core::util::DateTimeStamp::getYearShort | ( | void | ) | const |
Returns the current year - the last two digits.
Returns true if the given year is a leap year.
year | The year to test. |
bool imt::base::core::util::DateTimeStamp::operator!= | ( | const DateTimeStamp & | other | ) | const |
Not equals operator overload.
other | DateTime to compare with. |
bool imt::base::core::util::DateTimeStamp::operator< | ( | const DateTimeStamp & | other | ) | const |
Less than operator overload.
other | DateTime to compare with. |
bool imt::base::core::util::DateTimeStamp::operator<= | ( | const DateTimeStamp & | other | ) | const |
Less than or equal operator overload.
other | DateTime to compare with. |
DateTimeStamp& imt::base::core::util::DateTimeStamp::operator= | ( | const DateTimeStamp & | source | ) |
Assignment operator.
source | DateTime to assign. |
bool imt::base::core::util::DateTimeStamp::operator== | ( | const DateTimeStamp & | other | ) | const |
Equals operator overload.
other | DateTime to compare with. |
bool imt::base::core::util::DateTimeStamp::operator> | ( | const DateTimeStamp & | other | ) | const |
Greater than operator overload.
other | DateTime to compare with. |
bool imt::base::core::util::DateTimeStamp::operator>= | ( | const DateTimeStamp & | other | ) | const |
Greater than or equal operator overload.
other | DateTime to compare with. |
void imt::base::core::util::DateTimeStamp::setDay | ( | const uint8_t | day | ) |
Sets the day.
day | The day to set. |
void imt::base::core::util::DateTimeStamp::setHour | ( | const uint8_t | hour | ) |
Sets the hour.
hour | The hour to set. |
void imt::base::core::util::DateTimeStamp::setMinute | ( | const uint8_t | minute | ) |
Sets the minute.
minute | The minute to set. |
void imt::base::core::util::DateTimeStamp::setMonth | ( | const uint8_t | month | ) |
Sets the month.
month | The month to set. |
void imt::base::core::util::DateTimeStamp::setSecond | ( | const uint8_t | second | ) |
Sets the second.
second | The second to set. |
void imt::base::core::util::DateTimeStamp::setYear | ( | const uint16_t | year | ) |
Sets the year.
year | The year to set. |
void imt::base::core::util::DateTimeStamp::subtractDays | ( | const uint32_t | days | ) |
Subtracts the given amount of days from the timestamp.
days | The days to subtract. |
void imt::base::core::util::DateTimeStamp::subtractHours | ( | const uint32_t | hours | ) |
Subtracts the given amount of days from the timestamp.
hours | The hours to subtract. |
void imt::base::core::util::DateTimeStamp::subtractMinutes | ( | const uint32_t | minutes | ) |
Subtracts the given amount of days from the timestamp.
minutes | The minutes to subtract. |
void imt::base::core::util::DateTimeStamp::subtractSeconds | ( | const uint32_t | seconds | ) |
Subtracts the given amount of seconds from the timestamp.
seconds | The seconds to subtract. |