The code explicitly sets seconds to zero but leaves milliseconds. Since the result depends on current time, this may cause changes in milliseconds of calculated time which could leave to strange results (for example calculating time of next sunset immediately after sunset could give a new value which is after current time).
The simple change is to set milliseconds to zero too.
The code explicitly sets seconds to zero but leaves milliseconds. Since the result depends on current time, this may cause changes in milliseconds of calculated time which could leave to strange results (for example calculating time of next sunset immediately after sunset could give a new value which is after current time).
The simple change is to set milliseconds to zero too.