Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
SystemClockClass Class Reference

Public Member Functions

time_t now (TimeZone timeType=eTZ_Local)
 Get the current date and time. More...
 
bool setTime (time_t time, TimeZone timeType=eTZ_Local)
 Set the system clock's time. More...
 
String getSystemTimeString (TimeZone timeType=eTZ_Local)
 Get current time as a string. More...
 
bool setTimeZoneOffset (int seconds)
 Sets the local time zone offset. More...
 
bool setTimeZone (float localTimezoneOffset)
 
int getTimeZoneOffset ()
 

Member Function Documentation

String SystemClockClass::getSystemTimeString ( TimeZone  timeType = eTZ_Local)

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
time_t SystemClockClass::now ( TimeZone  timeType = eTZ_Local)

Get the current date and time.

Parameters
timeTypeTime zone to use (UTC / local)
Return values
DateTimeCurrent date and time
bool SystemClockClass::setTime ( time_t  time,
TimeZone  timeType = eTZ_Local 
)

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 local timezone time
bool SystemClockClass::setTimeZoneOffset ( int  seconds)

Sets the local time zone offset.

Parameters
localTimezoneOffsetOffset from UTC of local time zone in hours (-12..+12)
Return values
boolTrue on success
Todo:
Why does this need to be set to 2 for UK during winter?
Note
Supports whole hour and fraction of hour offsets from -12 hours to +12 hours