Skip to content

Commit

Permalink
Issue #1469 - conforming to java.util.Timer quirks
Browse files Browse the repository at this point in the history
  • Loading branch information
joakime committed Aug 8, 2017
1 parent 7b8e3bf commit 2d24922
Showing 1 changed file with 1 addition and 5 deletions.
Expand Up @@ -185,8 +185,6 @@ public RolloverFileOutputStream(String filename,
if (__rollover==null)
__rollover=new Timer(RolloverFileOutputStream.class.getName(),true);

_rollTask=new RollTask();

midnight = toMidnight(ZonedDateTime.now(), zone.toZoneId());

scheduleNextRollover();
Expand Down Expand Up @@ -214,14 +212,12 @@ public static ZonedDateTime toMidnight(ZonedDateTime dateTime, ZoneId zone)
public static ZonedDateTime nextMidnight(ZonedDateTime dateTime)
{
// Increment to next day.
// Using Calendar.add(DAY, 1) takes in account Daylights Savings
// differences, and still maintains the "midnight" settings for
// Hour, Minute, Second, Milliseconds
return dateTime.toLocalDate().plus(1, ChronoUnit.DAYS).atStartOfDay(dateTime.getZone());
}

private void scheduleNextRollover()
{
_rollTask = new RollTask();
midnight = nextMidnight(midnight);
__rollover.schedule(_rollTask,midnight.toInstant().toEpochMilli() - System.currentTimeMillis());
}
Expand Down

0 comments on commit 2d24922

Please sign in to comment.