//------------------------------------ // BOne_DateTime.ino // This file is part of BOne firmware // // Project home page : http://gyropode.vilain.de // date : 30.09.2014 // //------------------------------------- // // This firmware is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This firmware is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // //------------------------------------- void DateTime_Update() { DateTime now = RTC.now(); Serial.print(now.year(), DEC); Serial.print('/'); Serial.print(now.month(), DEC); Serial.print('/'); Serial.print(now.day(), DEC); Serial.print(' '); Serial.print(now.hour(), DEC); Serial.print(':'); Serial.print(now.minute(), DEC); Serial.print(':'); Serial.print(now.second(), DEC); Serial.println(); } //------------------------------------- // void summer_winter_time_Update(){ // last sunday of march beginDSTDate = (31 - (5 * GPS_year /4 + 4) % 7); beginDSTMonth = 3; //last sunday of october endDSTDate = (31 - (5 * GPS_year /4 + 1) % 7); endDSTMonth = 10; // DST is valid as: if (((GPS_month > beginDSTMonth) && (GPS_month < endDSTMonth)) || ((GPS_month == beginDSTMonth) && (GPS_day >= beginDSTDate)) || ((GPS_month == endDSTMonth) && (GPS_day <= endDSTDate))){ summer_time = true; // DST europe = utc + 2 hour (summer time) winter_time = false; }else{ winter_time = true; // nonDST europe = utc + 1 hour (winter time) summer_time = false; } if (summer_time){ BOne_hour = GPS_hour + 2; } if (winter_time){ BOne_hour = GPS_hour + 1; } if(BOne_hour >= 24){ BOne_hour -= 24; } } //--------------------------------------