17#ifndef SRC_SUPLA_CLOCK_CLOCK_H_
18#define SRC_SUPLA_CLOCK_CLOCK_H_
20#include <supla-common/proto.h>
21#include <supla/element.h>
23#include <supla/control/hvac_base.h>
27const char AutomaticTimeSyncCfgTag[] =
"timesync_auto";
29class Clock :
public Element {
31 static bool IsReady();
33 static int GetMonth();
35 static int GetDayOfWeek();
36 static enum DayOfWeek GetHvacDayOfWeek();
38 static int GetQuarter();
42 static time_t GetTimeStamp();
44 static Clock* GetInstance();
49 virtual bool isReady();
50 virtual int getYear();
51 virtual int getMonth();
53 virtual int getDayOfWeek();
54 virtual enum DayOfWeek getHvacDayOfWeek();
55 virtual int getHour();
56 virtual int getQuarter();
59 virtual time_t getTimeStamp();
68 void setUseAutomaticTimeSyncRemoteConfig(
bool value);
69 void printCurrentTime(
const char *prefix =
nullptr);
72 void setSystemTime(time_t newTime);
73 time_t localtime = {};
74 uint32_t lastServerUpdate = 0;
75 uint32_t lastMillis = 0;
76 bool isClockReady =
false;
77 bool automaticTimeSync =
true;
78 bool useAutomaticTimeSyncRemoteConfig =
true;
Definition SuplaDevice.h:93
bool iterateConnected() override
Method called on each SuplaDevice iteration when device is connected and registered to Supla server o...
Definition clock.cpp:229
void onTimer() override
Method called on timer interupt.
Definition clock.cpp:213
void onLoadConfig(SuplaDeviceClass *sdc) override
First method called on element in SuplaDevice.begin().
Definition clock.cpp:246
void onDeviceConfigChange(uint64_t fieldBit) override
Method called when device config is changed.
Definition clock.cpp:266