Example usage for java.time ZonedDateTime getZone

List of usage examples for java.time ZonedDateTime getZone

Introduction

In this page you can find the example usage for java.time ZonedDateTime getZone.

Prototype

@Override
public ZoneId getZone() 

Source Link

Document

Gets the time-zone, such as 'Europe/Paris'.

Usage

From source file:sorcer.file.ScratchDirManager.java

private boolean isCutoffTime(Path path, long cutOffTime) throws IOException {
    ZonedDateTime now = ZonedDateTime.now();
    BasicFileAttributes attrs = Files.readAttributes(path, BasicFileAttributes.class);
    ZonedDateTime created = ZonedDateTime.ofInstant(attrs.creationTime().toInstant(), now.getZone());

    created = created.withYear(now.getYear()).withMonth(now.getMonthValue());

    ZonedDateTime cutoff = created.plus(cutOffTime, MILLIS);

    log.info("Created {}", created);
    log.info("now     {}", now);
    log.info("cutoff  {}", cutoff);

    return now.isAfter(cutoff);
}