Simple general-purpose date/time class.
More...
|
uint8_t | yOff |
| Internal year offset value. More...
|
|
uint8_t | m |
| Internal month value.
|
|
uint8_t | d |
| Internal day value.
|
|
uint8_t | hh |
| Internal hour value.
|
|
uint8_t | mm |
| Internal minute value.
|
|
uint8_t | ss |
| Internal seconds.
|
|
Simple general-purpose date/time class.
Copied from RTClib. For further information on this implementation see https://github.com/Zanduino/MCP7940/wiki/DateTimeClass
◆ DateTime() [1/5]
DateTime constructor (overloaded)
Class Constructor for DateTime instantiates the class. This is an overloaded class constructor so there are multiple definitions. This implementation ignores time zones and DST changes. It also ignores leap seconds, see http://en.wikipedia.org/wiki/Leap_second
- Parameters
-
[in] | t | seconds since the year 1970 (UNIX timet) |
◆ DateTime() [2/5]
DateTime::DateTime |
( |
uint16_t |
year, |
|
|
uint8_t |
month, |
|
|
uint8_t |
day, |
|
|
uint8_t |
hour = 0 , |
|
|
uint8_t |
min = 0 , |
|
|
uint8_t |
sec = 0 |
|
) |
| |
DateTime constructor (overloaded)
Class Constructor for DateTime instantiates the class. This is an overloaded class constructor so there are multiple definitions. This implementation sets each component of the date/time separately
- Parameters
-
[in] | year | Year |
[in] | month | Month |
[in] | day | Day |
[in] | hour | Hour |
[in] | min | Minute |
[in] | sec | Second |
◆ DateTime() [3/5]
DateTime::DateTime |
( |
const DateTime & |
copy | ) |
|
DateTime constructor (overloaded)
Class Constructor for DateTime instantiates the class. This is an overloaded class constructor so there are multiple definitions. This implementation take a DateTime class value as the defining value
- Parameters
-
◆ DateTime() [4/5]
DateTime::DateTime |
( |
const char * |
date, |
|
|
const char * |
time |
|
) |
| |
DateTime constructor (overloaded)
Class Constructor for DateTime instantiates the class. This is an overloaded class constructor so there are multiple definitions. This implementation uses a Date string formatted as "MMM DD YYYY" and a time string formatted as "hh:mm:ss" for the value
- Parameters
-
[in] | date | Pointer to date string |
[in] | time | Pointer to time string |
◆ DateTime() [5/5]
DateTime::DateTime |
( |
const __FlashStringHelper * |
date, |
|
|
const __FlashStringHelper * |
time |
|
) |
| |
DateTime constructor (overloaded)
Class Constructor for DateTime instantiates the class. This is an overloaded class constructor so there are multiple definitions. This implementation uses the compile date and time as the value to set. It only works when the compiler runs in English. This implementation uses a Date string formatted as "MMM DD YYYY" and a time string formatted as "hh:mm:ss" for the value
- Parameters
-
[in] | date | Pointer to date string |
[in] | time | Pointer to time string |
◆ day()
uint8_t DateTime::day |
( |
| ) |
const |
|
inline |
return the current day of the month
◆ dayOfTheWeek()
uint8_t DateTime::dayOfTheWeek |
( |
| ) |
const |
return the current day-of-week where Monday is day 1, Sunday is 7
- Returns
- integer day-of-week 1-7
◆ equals()
bool DateTime::equals |
( |
const DateTime * |
other | ) |
|
return the current Unixtime
added equals method for class DateTime
- Returns
- true if date and time are equal else return false
◆ hour()
uint8_t DateTime::hour |
( |
| ) |
const |
|
inline |
◆ minute()
uint8_t DateTime::minute |
( |
| ) |
const |
|
inline |
return the current minute
◆ month()
uint8_t DateTime::month |
( |
| ) |
const |
|
inline |
◆ operator+()
return true if two datetimes hold the same value
overloaded "+" operator for class DateTime
- Returns
- Sum of two DateTime class instances
◆ operator-() [1/2]
Overloaded "+" operator to add two timespans
overloaded "+" operator for class DateTime
- Returns
- Sum of DateTime class and TimeSpan
◆ operator-() [2/2]
Overloaded "+" operator to add two timespans
overloaded "-" operator for class DateTime
- Returns
- Difference of two DateTime class instances
◆ second()
uint8_t DateTime::second |
( |
| ) |
const |
|
inline |
return the current second
◆ secondstime()
long DateTime::secondstime |
( |
void |
| ) |
const |
return the current day of the week starting at 0
return the time in seconds since the year 2000
- Returns
- number of seconds since 2000-01-01 00:00:00
◆ unixtime()
uint32_t DateTime::unixtime |
( |
void |
| ) |
const |
return the current seconds in the year
return the UNIX time, which is seconds since 1970-01-01 00:00:00
- Returns
- number of seconds since 1970-01-01 00:00:00 (Unixtime)
◆ year()
uint16_t DateTime::year |
( |
| ) |
const |
|
inline |
◆ yOff
Internal year offset value.
Overloaded "-" operator subtract add two timespans
The documentation for this class was generated from the following files: