Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Set milliseconds to zero too #4

merged 1 commit into from

2 participants


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.

@mikereedell mikereedell merged commit 3386d71 into mikereedell:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 25, 2013
  1. @aragaer

    Set milliseconds to zero too

    aragaer authored
This page is out of date. Refresh to see the latest.
1  src/main/java/com/luckycatlabs/sunrisesunset/calculator/
@@ -360,6 +360,7 @@ protected Calendar getLocalTimeAsCalendar(BigDecimal localTimeParam, Calendar da
resultTime.set(Calendar.HOUR_OF_DAY, hour);
resultTime.set(Calendar.MINUTE, minutes.intValue());
resultTime.set(Calendar.SECOND, 0);
+ resultTime.set(Calendar.MILLISECOND, 0);
return resultTime;
Something went wrong with that request. Please try again.