Real Time Clock. get time-str, set time.
Revision 2:32cfa1dac5a2, committed 2015-10-02
- Comitter:
- AkinoriHashimoto
- Date:
- Fri Oct 02 05:09:04 2015 +0000
- Parent:
- 1:b4e796fd32a9
- Child:
- 3:3f5628269a53
- Commit message:
- JST adjust.
Changed in this revision
RealTimeClock.cpp | Show annotated file Show diff for this revision Revisions of this file |
RealTimeClock.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/RealTimeClock.cpp Fri Oct 02 04:46:07 2015 +0000 +++ b/RealTimeClock.cpp Fri Oct 02 05:09:04 2015 +0000 @@ -39,7 +39,12 @@ bool RealTimeClock::setRealTime(string str) { - long now= A2I(str, 10); + // now is in range of appropriate time. + return setRealTime(A2I(str, 10)); +} + +bool RealTimeClock::setRealTime(long now) +{ now += 3600* 9; // + JST 9hour. // 1,427,597,183(ISO 8601形式: 2015/03/29 02:46:23Z) // 2,147,483,647秒を経過した (2038/01/19 03:14:07) @@ -47,14 +52,6 @@ return false; if(now == -1) return false; - - // now is in range of appropriate time. - setRealTime(now); - return true; -} - -void RealTimeClock::setRealTime(long now) -{ set_time(now); return; }
--- a/RealTimeClock.h Fri Oct 02 04:46:07 2015 +0000 +++ b/RealTimeClock.h Fri Oct 02 05:09:04 2015 +0000 @@ -39,6 +39,6 @@ * @param seconds from 1970/01/01. * @rtnval void */ - void setRealTime(long now); + bool setRealTime(long now); }; \ No newline at end of file