private long getTimeToNextBackup() {
    LocalDateTime now = LocalDateTime.now(Clock.systemUTC());

    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("H:mm");
    LocalTime backupTime = LocalTime.parse(ServerConfiguration
        .get(PropertyKey.MASTER_DAILY_BACKUP_TIME), formatter);
    LocalDateTime nextBackupTime = now.withHour(backupTime.getHour())
        .withMinute(backupTime.getMinute());
    if (nextBackupTime.isBefore(now)) {
      nextBackupTime = nextBackupTime.plusDays(1);
    }
    return ChronoUnit.MILLIS.between(now, nextBackupTime);
  }
private long getTimeToNextBackup ( ) { LocalDateTime now = LocalDateTime . now ( Clock . systemUTC ( ) ) ; DateTimeFormatter formatter = DateTimeFormatter . ofPattern ( "H:mm" ) ; LocalTime backupTime = LocalTime . parse ( ServerConfiguration . get ( PropertyKey . MASTER_DAILY_BACKUP_TIME ) , formatter ) ; LocalDateTime nextBackupTime = now . withHour ( backupTime . getHour ( ) ) . withMinute ( backupTime . getMinute ( ) ) ; if ( nextBackupTime . isBefore ( now ) ) { nextBackupTime = nextBackupTime . plusDays ( 1 ) ; } return ChronoUnit . MILLIS . between ( now , nextBackupTime ) ; }
Gets the time gap between now and next backup time.

@return the time gap to next backup