diff options
Diffstat (limited to 'HouseControl.ino')
-rw-r--r-- | HouseControl.ino | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/HouseControl.ino b/HouseControl.ino index b62d743..75cf9be 100644 --- a/HouseControl.ino +++ b/HouseControl.ino @@ -176,23 +176,23 @@ void sendNTPpacket() { } void parseNTPresponse() { - byte pb[48]; +// byte pb[48]; unsigned long ntp_time = 0; float ntp_time_frac; // read the packet into the buffer - NTPSocket.read(pb, sizeof(pb)); + NTPSocket.read(buf1, sizeof(buf1)); // NTP contains four timestamps with an integer part and a fraction part // we only use the integer part here for (int i=40; i<44; i++) - ntp_time = ntp_time << 8 | pb[i]; + ntp_time = ntp_time << 8 | buf1[i]; // part of the fractional part // could be 4 bytes but this is more precise than the 1307 RTC // which has a precision of ONE second // in fact one byte is sufficient for 1307 - ntp_time_frac = ((long)pb[44] * 256 + pb[45]) / 65536.0; + ntp_time_frac = ((long)buf1[44] * 256 + buf1[45]) / 65536.0; // convert NTP to UNIX time, differs seventy years = 2208988800 seconds // NTP starts Jan 1, 1900 |