Dataflow Runtime API  3.1.1.0
Public Member Functions | Static Public Member Functions | List of all members
imt::base::core::util::DateTimeStamp Class Reference

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...
 
DateTimeStampoperator= (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...
 

Detailed Description

Class to access date and time information.

Constructor & Destructor Documentation

◆ DateTimeStamp() [1/2]

imt::base::core::util::DateTimeStamp::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 
)
explicit

Constructor for DateTimeStamps with full date and time information.

Default initialization: year = 0U, month = 1U, day = 1U, hour = 0U, minute = 0U, second = 0U

Parameters
yearThe current year.
monthThe current month.
dayThe current day.
hourThe current hour.
minuteThe current minute.
secondThe current second.

◆ DateTimeStamp() [2/2]

imt::base::core::util::DateTimeStamp::DateTimeStamp ( const DateTimeStamp source)

Copy constructor.

Parameters
sourceOther DateTimeStamp object to copy.

◆ ~DateTimeStamp()

virtual imt::base::core::util::DateTimeStamp::~DateTimeStamp ( void  )
virtual

Destructor.

Member Function Documentation

◆ addDays()

void imt::base::core::util::DateTimeStamp::addDays ( const uint32_t  days)

Adds the given amount of days to the timestamp.

Parameters
daysThe days to add.

◆ addHours()

void imt::base::core::util::DateTimeStamp::addHours ( const uint32_t  hours)

Adds the given amount of days to the timestamp.

Parameters
hoursThe hours to add.

◆ addMinutes()

void imt::base::core::util::DateTimeStamp::addMinutes ( const uint32_t  minutes)

Adds the given amount of days to the timestamp.

Parameters
minutesThe minutes to add.

◆ addSeconds()

void imt::base::core::util::DateTimeStamp::addSeconds ( const uint32_t  seconds)

Adds the given amount of seconds to the timestamp.

Parameters
secondsThe seconds to add.

◆ getDay()

uint8_t imt::base::core::util::DateTimeStamp::getDay ( void  ) const

Returns the current day.

Returns
The current day.

◆ getDifferenceDays()

static uint32_t imt::base::core::util::DateTimeStamp::getDifferenceDays ( const DateTimeStamp date1,
const DateTimeStamp date2 
)
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

Parameters
date1Date 1.
date2Date 2.
Returns
Difference of the two DateTimeStamps in days.

◆ getHour()

uint8_t imt::base::core::util::DateTimeStamp::getHour ( void  ) const

Returns the current hour.

Returns
The current hour.

◆ getMinute()

uint8_t imt::base::core::util::DateTimeStamp::getMinute ( void  ) const

Returns the current minute.

Returns
The current minute.

◆ getMonth()

uint8_t imt::base::core::util::DateTimeStamp::getMonth ( void  ) const

Returns the current month.

Returns
The current month (January = 1, February = 2, ..., December = 12).

◆ getNumberOfDaysOfMonth()

static uint8_t imt::base::core::util::DateTimeStamp::getNumberOfDaysOfMonth ( const uint8_t  month,
const uint16_t  year 
)
static

Gets the number of days of the given month.

Parameters
monthThe month of which the number of days is requested.
yearThe year of which the number of days per month is requested.
Returns
Number of days of the given month.

◆ getSecond()

uint8_t imt::base::core::util::DateTimeStamp::getSecond ( void  ) const

Returns the current second.

Returns
The current second.

◆ getYear()

uint16_t imt::base::core::util::DateTimeStamp::getYear ( void  ) const

Returns the current year.

Returns
The current year.

◆ getYearShort()

uint16_t imt::base::core::util::DateTimeStamp::getYearShort ( void  ) const

Returns the current year - the last two digits.

Returns
The current year.

◆ isLeapYear()

static bool imt::base::core::util::DateTimeStamp::isLeapYear ( const uint16_t  year)
static

Returns true if the given year is a leap year.

Parameters
yearThe year to test.
Returns
True if given year is a leap year.

◆ operator!=()

bool imt::base::core::util::DateTimeStamp::operator!= ( const DateTimeStamp other) const

Not equals operator overload.

Parameters
otherDateTime to compare with.
Returns
True if instances are not equal.

◆ operator<()

bool imt::base::core::util::DateTimeStamp::operator< ( const DateTimeStamp other) const

Less than operator overload.

Parameters
otherDateTime to compare with.
Returns
True if this instance is before the other instance.

◆ operator<=()

bool imt::base::core::util::DateTimeStamp::operator<= ( const DateTimeStamp other) const

Less than or equal operator overload.

Parameters
otherDateTime to compare with.
Returns
True if this instance is before or equal.

◆ operator=()

DateTimeStamp& imt::base::core::util::DateTimeStamp::operator= ( const DateTimeStamp source)

Assignment operator.

Parameters
sourceDateTime to assign.
Returns
Reference to this object.

◆ operator==()

bool imt::base::core::util::DateTimeStamp::operator== ( const DateTimeStamp other) const

Equals operator overload.

Parameters
otherDateTime to compare with.
Returns
True if instances are equal.

◆ operator>()

bool imt::base::core::util::DateTimeStamp::operator> ( const DateTimeStamp other) const

Greater than operator overload.

Parameters
otherDateTime to compare with.
Returns
True if this instance is after the other instance.

◆ operator>=()

bool imt::base::core::util::DateTimeStamp::operator>= ( const DateTimeStamp other) const

Greater than or equal operator overload.

Parameters
otherDateTime to compare with.
Returns
True if this instance is after or equal.

◆ setDay()

void imt::base::core::util::DateTimeStamp::setDay ( const uint8_t  day)

Sets the day.

Parameters
dayThe day to set.

◆ setHour()

void imt::base::core::util::DateTimeStamp::setHour ( const uint8_t  hour)

Sets the hour.

Parameters
hourThe hour to set.

◆ setMinute()

void imt::base::core::util::DateTimeStamp::setMinute ( const uint8_t  minute)

Sets the minute.

Parameters
minuteThe minute to set.

◆ setMonth()

void imt::base::core::util::DateTimeStamp::setMonth ( const uint8_t  month)

Sets the month.

Parameters
monthThe month to set.

◆ setSecond()

void imt::base::core::util::DateTimeStamp::setSecond ( const uint8_t  second)

Sets the second.

Parameters
secondThe second to set.

◆ setYear()

void imt::base::core::util::DateTimeStamp::setYear ( const uint16_t  year)

Sets the year.

Parameters
yearThe year to set.

◆ subtractDays()

void imt::base::core::util::DateTimeStamp::subtractDays ( const uint32_t  days)

Subtracts the given amount of days from the timestamp.

Parameters
daysThe days to subtract.

◆ subtractHours()

void imt::base::core::util::DateTimeStamp::subtractHours ( const uint32_t  hours)

Subtracts the given amount of days from the timestamp.

Parameters
hoursThe hours to subtract.

◆ subtractMinutes()

void imt::base::core::util::DateTimeStamp::subtractMinutes ( const uint32_t  minutes)

Subtracts the given amount of days from the timestamp.

Parameters
minutesThe minutes to subtract.

◆ subtractSeconds()

void imt::base::core::util::DateTimeStamp::subtractSeconds ( const uint32_t  seconds)

Subtracts the given amount of seconds from the timestamp.

Parameters
secondsThe seconds to subtract.

The documentation for this class was generated from the following file: