EnigmaIOT  0.9.8
Secure sensor and gateway platform based on ESP8266 and ESP32
Public Member Functions | Protected Attributes | List of all members
TimeManagerClass Class Reference

#include <timeManager.h>

Public Member Functions

int64_t clock ()
 Gets local clock. More...
 
int64_t clock_us ()
 Gets local clock. More...
 
time_t unixtime ()
 Gets local clock in seconds. It returns millis() / 1000 if not synchronized, local clock otherwise. This may contain current realtime clock if Gateway is synchronized using NTP time. More...
 
int64_t adjustTime (int64_t t1r, int64_t t2r, int64_t t3r, int64_t t4r)
 Gets delay between Gateway time and local clock and adjust local clock accordingly. It uses same procedure as SNTP protocol. More...
 
int64_t getOffset ()
 Gets current offset to calculate clock, in milliseconds. More...
 
bool isTimeAdjusted ()
 Gets synchronization status. More...
 
int64_t getDelay ()
 Gets propagation + processing delay between Node and Gateway in milliseconds. More...
 
void reset ()
 Resets clock synchronization and sets values to initial status. More...
 

Protected Attributes

bool timeIsAdjusted = false
 Indicates if time has been synchronized. More...
 
int64_t offset = 0
 Offet between node millis() and gateway time. More...
 
int64_t roundTripDelay
 Propagation delay between Node and Gateway. More...
 

Detailed Description

Definition at line 15 of file timeManager.h.

Member Function Documentation

◆ adjustTime()

int64_t TimeManagerClass::adjustTime ( int64_t  t1r,
int64_t  t2r,
int64_t  t3r,
int64_t  t4r 
)

Gets delay between Gateway time and local clock and adjust local clock accordingly. It uses same procedure as SNTP protocol.

Parameters
t1rT1
t2rT2
t3rT3
t4rT4
Returns
Clock value in seconds. It uses UnixTime format

Definition at line 34 of file timeManager.cpp.

◆ clock()

int64_t TimeManagerClass::clock ( )

Gets local clock.

Returns
Clock value in milliseconds

Definition at line 12 of file timeManager.cpp.

◆ clock_us()

int64_t TimeManagerClass::clock_us ( )

Gets local clock.

Returns
Clock value in microseconds

Definition at line 23 of file timeManager.cpp.

◆ getDelay()

int64_t TimeManagerClass::getDelay ( )
inline

Gets propagation + processing delay between Node and Gateway in milliseconds.

Returns
Delay value in ms

Definition at line 75 of file timeManager.h.

◆ getOffset()

int64_t TimeManagerClass::getOffset ( )
inline

Gets current offset to calculate clock, in milliseconds.

Returns
Offset value in ms

Definition at line 59 of file timeManager.h.

◆ isTimeAdjusted()

bool TimeManagerClass::isTimeAdjusted ( )
inline

Gets synchronization status.

Returns
True if clock is synchronized

Definition at line 67 of file timeManager.h.

◆ reset()

void TimeManagerClass::reset ( )
inline

Resets clock synchronization and sets values to initial status.

Definition at line 82 of file timeManager.h.

◆ unixtime()

time_t TimeManagerClass::unixtime ( )
inline

Gets local clock in seconds. It returns millis() / 1000 if not synchronized, local clock otherwise. This may contain current realtime clock if Gateway is synchronized using NTP time.

Returns
Clock value in seconds. It uses UnixTime format

Definition at line 40 of file timeManager.h.

Member Data Documentation

◆ offset

int64_t TimeManagerClass::offset = 0
protected

Offet between node millis() and gateway time.

Definition at line 18 of file timeManager.h.

◆ roundTripDelay

int64_t TimeManagerClass::roundTripDelay
protected

Propagation delay between Node and Gateway.

Definition at line 19 of file timeManager.h.

◆ timeIsAdjusted

bool TimeManagerClass::timeIsAdjusted = false
protected

Indicates if time has been synchronized.

Definition at line 17 of file timeManager.h.


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