Real Time Clock. get time-str, set time.
Diff: RealTimeClock.h
- Revision:
- 5:82e566457502
- Parent:
- 4:d1c394cd7b63
--- a/RealTimeClock.h Thu Nov 19 07:56:35 2015 +0000 +++ b/RealTimeClock.h Tue Nov 24 07:09:30 2015 +0000 @@ -6,11 +6,19 @@ #include "StrLib.h" /** Real Time Clock library - * + * */ class RealTimeClock { public: + /** Time Zone */ + enum TimeZone { + UTC, GMT, JST, EST, CST, MST, PST + }; + + RealTimeClock(TimeZone tz= JST); + RealTimeClock(float hour); + /** @rtnval YY/MM/DD */ string getYMD8(); @@ -27,16 +35,20 @@ * @param 'seconds' from 1970/01/01. * @rtnval success(true), failure(false) */ - bool setRealTime(string str, bool JPN= true); + bool setRealTime(string str); /** * @param seconds from 1970/01/01. * @rtnval void */ - bool setRealTime(long now, bool JPN= true); + bool setRealTime(long now); + + void setTimeZone(TimeZone tz); + void setTimeZone(float hour); private: time_t secRT; // secondsRealTime. JST; 9hour + int offsetTimeZone; // [s]. internal TimeZone val. char buf[14]; // using for strftime() string bufTmp; // return value void setSecondsRealTime(); // set secRt;