#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()

String SystemClockClass::getSystemTimeString ( TimeZone  timeType = eTZ_Local) const

Get current time as a string.

Parameters
timeTypeTime zone to present time as, i.e. return local or UTC time
Return values
StringCurrent 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()

int SystemClockClass::getTimeZoneOffset ( ) const
inline

Get the current time zone offset.

Return values
intOffset in seconds from UTC

◆ isSet()

bool SystemClockClass::isSet ( ) const
inline

Determine if setTime() has been called yet.

Note
Indicates whether time returned can be relied upon

◆ now()

time_t SystemClockClass::now ( TimeZone  timeType = eTZ_Local) const

Get the current date and time.

Parameters
timeTypeTime zone to use (UTC / local)
Return values
DateTimeCurrent date and time

◆ setTime()

bool SystemClockClass::setTime ( time_t  time,
TimeZone  timeType 
)

Set the system clock's time.

Parameters
timeUnix time to set clock to (quantity of seconds since 00:00:00 1970-01-01)
timeTypeTime 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()

bool SystemClockClass::setTimeZone ( float  localTimezoneOffset)
inline

Set the local time zone offset in hours.

Parameters
localTimezoneOffsetOffset from UTC of local time zone in hours (-12.0 < offset < +12.0)
Return values
booltrue on success, false if value out of range

◆ setTimeZoneOffset()

bool SystemClockClass::setTimeZoneOffset ( int  seconds)

Sets the local time zone offset.

Parameters
secondsOffset from UTC of local time zone in seconds (-720 < offset < +720)
Return values
booltrue on success, false if value out of range

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