Real Time Clock. get time-str, set time.
Revision 6:605138b5eef6, committed 2015-11-25
- Comitter:
- AkinoriHashimoto
- Date:
- Wed Nov 25 09:56:26 2015 +0000
- Parent:
- 5:82e566457502
- Commit message:
- ADJ TimeZone
Changed in this revision
RealTimeClock.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/RealTimeClock.cpp Tue Nov 24 07:09:30 2015 +0000 +++ b/RealTimeClock.cpp Wed Nov 25 09:56:26 2015 +0000 @@ -8,7 +8,6 @@ { setTimeZone(hour); } - void RealTimeClock::setSecondsRealTime() { secRT = time(NULL); @@ -71,27 +70,24 @@ void RealTimeClock::setTimeZone(TimeZone tz) { float hour= 0; - if(UTC || GMT) + if(tz==UTC || tz==GMT) hour= 0; - if(JST) + if(tz == JST) hour= +9; - if(EST) + if(tz == EST) hour= -5; - if(CST) + if(tz == CST) hour= -6; - if(MST) + if(tz == MST) hour= -7; - if(PST) + if(tz == PST) hour= -8; - this->setTimeZone(hour); - return; } void RealTimeClock::setTimeZone(float hour) { - this->offsetTimeZone= (int)(hour* 3600); - + this->offsetTimeZone= (int)(hour* 3600+ 0.5); return; }