Telescope Control Library
RTCClock.h
- Committer:
- caoyu@caoyuan9642-desktop.MIT.EDU
- Date:
- 2018-09-24
- Revision:
- 19:fd854309cb4c
- Parent:
- 0:6cb2eaf8b133
File content as of revision 19:fd854309cb4c:
#ifndef RTCCLOCK_H_ #define RTCCLOCK_H_ #include "mbed.h" #include "UTCClock.h" /** * RTCClock class implements the UTCClock interface and provides time through the MBED interface to hardware RTC found on most ARM MCUs */ class RTCClock: public UTCClock { protected: time_t t; public: RTCClock() { time(&t); } ~RTCClock() { } time_t getTime() { time(&t); return t; } void setTime(time_t newtime) { set_time(newtime); t = newtime; } static RTCClock& getInstance() { static RTCClock clock; return clock; } }; #endif /*RTCCLOCK_H_*/