mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
* BIG refactor: 'board' and 'radio' objects now defined in 'target.h/.cpp'
* mesh::RTCClock class moved to MeshCore.h
This commit is contained in:
parent
0a5a115875
commit
bfb4b1c496
48 changed files with 726 additions and 407 deletions
|
|
@ -45,4 +45,32 @@ public:
|
|||
virtual bool startOTAUpdate() { return false; } // not supported
|
||||
};
|
||||
|
||||
/**
|
||||
* An abstraction of the device's Realtime Clock.
|
||||
*/
|
||||
class RTCClock {
|
||||
uint32_t last_unique;
|
||||
protected:
|
||||
RTCClock() { last_unique = 0; }
|
||||
|
||||
public:
|
||||
/**
|
||||
* \returns the current time. in UNIX epoch seconds.
|
||||
*/
|
||||
virtual uint32_t getCurrentTime() = 0;
|
||||
|
||||
/**
|
||||
* \param time current time in UNIX epoch seconds.
|
||||
*/
|
||||
virtual void setCurrentTime(uint32_t time) = 0;
|
||||
|
||||
uint32_t getCurrentTimeUnique() {
|
||||
uint32_t t = getCurrentTime();
|
||||
if (t <= last_unique) {
|
||||
return ++last_unique;
|
||||
}
|
||||
return last_unique = t;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue