Real Time Clock. get time-str, set time.
RealTimeClock.h@1:b4e796fd32a9, 2015-10-02 (annotated)
- Committer:
- AkinoriHashimoto
- Date:
- Fri Oct 02 04:46:07 2015 +0000
- Revision:
- 1:b4e796fd32a9
- Parent:
- 0:006ab0d7b90f
- Child:
- 2:32cfa1dac5a2
include StrLib.h
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AkinoriHashimoto | 0:006ab0d7b90f | 1 | #pragma once |
AkinoriHashimoto | 0:006ab0d7b90f | 2 | |
AkinoriHashimoto | 0:006ab0d7b90f | 3 | #include "mbed.h" |
AkinoriHashimoto | 0:006ab0d7b90f | 4 | #include <string> |
AkinoriHashimoto | 0:006ab0d7b90f | 5 | |
AkinoriHashimoto | 0:006ab0d7b90f | 6 | #include "StrLib.h" |
AkinoriHashimoto | 0:006ab0d7b90f | 7 | |
AkinoriHashimoto | 0:006ab0d7b90f | 8 | /** Real Time Clock library |
AkinoriHashimoto | 0:006ab0d7b90f | 9 | * |
AkinoriHashimoto | 0:006ab0d7b90f | 10 | */ |
AkinoriHashimoto | 0:006ab0d7b90f | 11 | class RealTimeClock |
AkinoriHashimoto | 0:006ab0d7b90f | 12 | { |
AkinoriHashimoto | 0:006ab0d7b90f | 13 | private: |
AkinoriHashimoto | 0:006ab0d7b90f | 14 | time_t secRT; // secondsRealTime. JST; 9hour |
AkinoriHashimoto | 0:006ab0d7b90f | 15 | char buf[14]; // using for strftime() |
AkinoriHashimoto | 0:006ab0d7b90f | 16 | string bufTmp; // return value |
AkinoriHashimoto | 0:006ab0d7b90f | 17 | void setSecondsRealTime(); // set secRt; |
AkinoriHashimoto | 0:006ab0d7b90f | 18 | |
AkinoriHashimoto | 0:006ab0d7b90f | 19 | public: |
AkinoriHashimoto | 0:006ab0d7b90f | 20 | /** @rtnval YY/MM/DD */ |
AkinoriHashimoto | 0:006ab0d7b90f | 21 | string getYMD8(); |
AkinoriHashimoto | 0:006ab0d7b90f | 22 | |
AkinoriHashimoto | 0:006ab0d7b90f | 23 | /** @rtnval YYMMDD */ |
AkinoriHashimoto | 0:006ab0d7b90f | 24 | string getYMD6(); |
AkinoriHashimoto | 0:006ab0d7b90f | 25 | |
AkinoriHashimoto | 0:006ab0d7b90f | 26 | /** @rtnval HH:MM:SS */ |
AkinoriHashimoto | 0:006ab0d7b90f | 27 | string getHMS8(); |
AkinoriHashimoto | 0:006ab0d7b90f | 28 | |
AkinoriHashimoto | 0:006ab0d7b90f | 29 | /** @rtnval HHMMSS */ |
AkinoriHashimoto | 0:006ab0d7b90f | 30 | string getHMS6(); |
AkinoriHashimoto | 0:006ab0d7b90f | 31 | |
AkinoriHashimoto | 0:006ab0d7b90f | 32 | /** |
AkinoriHashimoto | 0:006ab0d7b90f | 33 | * @param seconds from 1970/01/01. |
AkinoriHashimoto | 0:006ab0d7b90f | 34 | * @rtnval success(true), failure(false) |
AkinoriHashimoto | 0:006ab0d7b90f | 35 | */ |
AkinoriHashimoto | 0:006ab0d7b90f | 36 | bool setRealTime(string str); |
AkinoriHashimoto | 0:006ab0d7b90f | 37 | |
AkinoriHashimoto | 0:006ab0d7b90f | 38 | /** |
AkinoriHashimoto | 0:006ab0d7b90f | 39 | * @param seconds from 1970/01/01. |
AkinoriHashimoto | 0:006ab0d7b90f | 40 | * @rtnval void |
AkinoriHashimoto | 0:006ab0d7b90f | 41 | */ |
AkinoriHashimoto | 0:006ab0d7b90f | 42 | void setRealTime(long now); |
AkinoriHashimoto | 0:006ab0d7b90f | 43 | |
AkinoriHashimoto | 0:006ab0d7b90f | 44 | }; |