Skip to content

Commit

Permalink
javamelody#668 RrdException: Invalid timestamps specified: 1504686302…
Browse files Browse the repository at this point in the history
…, 1504686302
  • Loading branch information
evernat authored and elnggng committed Mar 17, 2022
1 parent 1eae2e1 commit 6893ef2
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ public static Range createCustomRange(Date startDate, Date endDate) {
if (normalizedStartDate.getTime() > System.currentTimeMillis()) {
// pour raison de performance, on limite à aujourd'hui (et non 2000 ans)
normalizedStartDate = new Date();

// mais ici la date de début est à 0h
// (et le formatage de cette date reste donc au même jour)
// for issue 668 when using custom period with both dates in the future to display a graph
// (RrdException: Invalid timestamps specified: 1504686302, 1504686302)
final Calendar calendar = Calendar.getInstance();
calendar.setTime(normalizedStartDate);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
normalizedStartDate = calendar.getTime();
}

if (normalizedEndDate.getTime() > System.currentTimeMillis()) {
Expand Down

0 comments on commit 6893ef2

Please sign in to comment.