PaulStoffregen / Time

Time library for Arduino
http://playground.arduino.cc/code/time
1.25k stars 666 forks source link

Ignore SetTime(0) #121

Open Bolukan opened 5 years ago

Bolukan commented 5 years ago

Description

In https://github.com/gmag11/NtpClient#developer setTime(0) is called (0 is return of other function) with the presumption setTime(0) would be ignored by your library. Do you accept a change to ignore setTime(0) calls in your library? If yes, I will propose a pull request.

Steps To Reproduce Problem

setTime(0) resets time to 1970.

Hardware & Software

N/A

Arduino Sketch

N/A

Errors or Incorrect Output

N/A

Eheran1 commented 4 years ago

I would expect that setTime(0) sets the time to 00:00:00 UTC on 1 January 1970. Everything else would be unexpected behavior for me. You should just catch this case like... if (timevariable != 0)