4#ifndef SRC_SUPLA_CLOCK_CLOCK_H_
5#define SRC_SUPLA_CLOCK_CLOCK_H_
7#include <supla-common/proto.h>
8#include <supla/element.h>
10#include <supla/control/hvac_base.h>
14const char AutomaticTimeSyncCfgTag[] =
"timesync_auto";
18 static bool IsReady();
20 static int GetMonth();
22 static int GetDayOfWeek();
23 static enum DayOfWeek GetHvacDayOfWeek();
25 static int GetQuarter();
29 static time_t GetTimeStamp();
31 static Clock* GetInstance();
36 virtual bool isReady();
37 virtual int getYear();
38 virtual int getMonth();
40 virtual int getDayOfWeek();
41 virtual enum DayOfWeek getHvacDayOfWeek();
42 virtual int getHour();
43 virtual int getQuarter();
46 virtual time_t getTimeStamp();
55 void setUseAutomaticTimeSyncRemoteConfig(
bool value);
56 void printCurrentTime(
const char *prefix =
nullptr);
58 void setAutomaticTimeSync(
bool value) { automaticTimeSync = value; }
61 void setSystemTime(time_t newTime);
62 time_t localtime = {};
63 uint32_t lastServerUpdate = 0;
64 uint32_t lastMillis = 0;
65 bool isClockReady =
false;
66 bool automaticTimeSync =
true;
67 bool useAutomaticTimeSyncRemoteConfig =
true;
Definition SuplaDevice.h:167
bool iterateConnected() override
Method called on each SuplaDevice iteration when device is connected and registered to Supla server o...
Definition clock.cpp:220
void onTimer() override
Method called on timer interupt.
Definition clock.cpp:204
void onLoadConfig(SuplaDeviceClass *sdc) override
First method called on element in SuplaDevice.begin().
Definition clock.cpp:237
void onDeviceConfigChange(uint64_t fieldBit) override
Method called when device config is changed.
Definition clock.cpp:261
Base class for all elements of SuplaDevice.
Definition element.h:27