SystemClockClass Class Reference
#include <SystemClock.h>
Public Member Functions | |
time_t | now (TimeZone timeType=eTZ_Local) const |
Get the current date and time. More... | |
bool | setTime (time_t time, TimeZone timeType) |
Set the system clock's time. More... | |
String | getSystemTimeString (TimeZone timeType=eTZ_Local) const |
Get current time as a string. More... | |
bool | setTimeZoneOffset (int seconds) |
Sets the local time zone offset. More... | |
bool | setTimeZone (float localTimezoneOffset) |
Set the local time zone offset in hours. More... | |
int | getTimeZoneOffset () const |
Get the current time zone offset. More... | |
bool | isSet () const |
Determine if setTime() has been called yet. More... | |
Member Function Documentation
◆ getSystemTimeString()
Get current time as a string.
- Parameters
-
timeType Time zone to present time as, i.e. return local or UTC time
- Return values
-
String Current time in format: dd.mm.yy hh:mm:ss
- Note
- Date separator may be changed by adding
#define DT_DATE_SEPARATOR "/"
to source code
◆ getTimeZoneOffset()
|
inline |
Get the current time zone offset.
- Return values
-
int Offset in seconds from UTC
◆ isSet()
|
inline |
Determine if setTime()
has been called yet.
- Note
- Indicates whether time returned can be relied upon
◆ now()
Get the current date and time.
- Parameters
-
timeType Time zone to use (UTC / local)
- Return values
-
DateTime Current date and time
◆ setTime()
bool SystemClockClass::setTime | ( | time_t | time, |
TimeZone | timeType | ||
) |
Set the system clock's time.
- Parameters
-
time Unix time to set clock to (quantity of seconds since 00:00:00 1970-01-01) timeType Time zone of Unix time, i.e. is time provided as local or UTC?
- Note
- System time is always stored as UTC time. If setting using the value retrieved from a time server using NTP, specify eTZ_UTC. If passing a local value using eTZ_Local, ensure that the time zone has been set correctly as it will be converted to UTC before storing.
◆ setTimeZone()
|
inline |
Set the local time zone offset in hours.
- Parameters
-
localTimezoneOffset Offset from UTC of local time zone in hours (-12.0 < offset < +12.0)
- Return values
-
bool true on success, false if value out of range
◆ setTimeZoneOffset()
bool SystemClockClass::setTimeZoneOffset | ( | int | seconds | ) |
Sets the local time zone offset.
- Parameters
-
seconds Offset from UTC of local time zone in seconds (-720 < offset < +720)
- Return values
-
bool true on success, false if value out of range
The documentation for this class was generated from the following file: