List of usage examples for java.time Duration minusDays
public Duration minusDays(long daysToSubtract)
From source file:Main.java
public static void main(String[] args) { Duration duration = Duration.between(LocalTime.MIDNIGHT, LocalTime.NOON); System.out.println(duration.getSeconds()); duration = duration.minusDays(3); System.out.println(duration.getSeconds()); }
From source file:org.jgrades.security.service.UserDetailsServiceImpl.java
private boolean isCredentialsNotExpired(User user) { Set<JgRole> userRoles = userMgntService.getUserRoles(user); int expirationDaysForRole = getExpirationDays(getRoleWithHighestPriority(userRoles)); if (expirationDaysForRole != 0) { LocalDateTime lastPasswordChangeTime = passwordDataRepository.getPasswordDataWithUser(user.getLogin()) .getLastChange();/*from w ww .j a v a 2 s . c o m*/ Duration duration = Duration.between(lastPasswordChangeTime, LocalDateTime.now()); return duration.minusDays(expirationDaysForRole).isNegative(); } else { return true; } }