EnigmaIOT
0.9.8
Secure sensor and gateway platform based on ESP8266 and ESP32
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
Functions
Variables
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
w
~
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
~
Variables
_
a
b
c
d
e
f
g
i
k
l
m
n
o
p
q
r
s
t
u
w
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Functions
a
b
c
d
f
g
i
l
m
n
o
p
s
w
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
w
Typedefs
Enumerations
Enumerator
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Macros
_
b
c
d
e
g
h
i
l
m
n
o
r
s
t
u
v
w
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
timeManager.h
Go to the documentation of this file.
1
9
#ifndef _TIMEMANAGER_h
10
#define _TIMEMANAGER_h
11
12
#include <Arduino.h>
13
#include "sys/time.h"
14
15
class
TimeManagerClass
{
16
protected
:
17
bool
timeIsAdjusted
=
false
;
18
int64_t
offset
= 0;
19
int64_t
roundTripDelay
;
20
21
public
:
26
int64_t
clock
();
27
32
int64_t
clock_us
();
33
34
40
time_t
unixtime
() {
41
uint64_t time_sec =
clock
() / 1000000L;
42
return
time_sec;
43
}
44
53
int64_t
adjustTime
(int64_t t1r, int64_t t2r, int64_t t3r, int64_t t4r);
54
59
int64_t
getOffset
() {
60
return
offset
;
61
}
62
67
bool
isTimeAdjusted
() {
68
return
timeIsAdjusted
;
69
}
70
75
int64_t
getDelay
() {
76
return
roundTripDelay
;
77
}
78
82
void
reset
() {
83
offset
= 0;
84
timeIsAdjusted
=
false
;
85
}
86
};
87
88
extern
TimeManagerClass
TimeManager
;
89
90
#endif
91
TimeManagerClass::clock_us
int64_t clock_us()
Gets local clock.
Definition:
timeManager.cpp:23
TimeManagerClass::isTimeAdjusted
bool isTimeAdjusted()
Gets synchronization status.
Definition:
timeManager.h:67
TimeManagerClass::unixtime
time_t unixtime()
Gets local clock in seconds. It returns millis() / 1000 if not synchronized, local clock otherwise....
Definition:
timeManager.h:40
TimeManagerClass::adjustTime
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....
Definition:
timeManager.cpp:34
TimeManagerClass::roundTripDelay
int64_t roundTripDelay
Propagation delay between Node and Gateway.
Definition:
timeManager.h:19
TimeManagerClass::getDelay
int64_t getDelay()
Gets propagation + processing delay between Node and Gateway in milliseconds.
Definition:
timeManager.h:75
TimeManager
TimeManagerClass TimeManager
Definition:
timeManager.cpp:65
TimeManagerClass::timeIsAdjusted
bool timeIsAdjusted
Indicates if time has been synchronized.
Definition:
timeManager.h:17
TimeManagerClass::getOffset
int64_t getOffset()
Gets current offset to calculate clock, in milliseconds.
Definition:
timeManager.h:59
TimeManagerClass::clock
int64_t clock()
Gets local clock.
Definition:
timeManager.cpp:12
TimeManagerClass
Definition:
timeManager.h:15
TimeManagerClass::offset
int64_t offset
Offet between node millis() and gateway time.
Definition:
timeManager.h:18
TimeManagerClass::reset
void reset()
Resets clock synchronization and sets values to initial status.
Definition:
timeManager.h:82
Generated by
1.8.20