Example usage for java.time.temporal ChronoField INSTANT_SECONDS

List of usage examples for java.time.temporal ChronoField INSTANT_SECONDS

Introduction

In this page you can find the example usage for java.time.temporal ChronoField INSTANT_SECONDS.

Prototype

ChronoField INSTANT_SECONDS

To view the source code for java.time.temporal ChronoField INSTANT_SECONDS.

Click Source Link

Document

The instant epoch-seconds.

Usage

From source file:msi.gama.util.GamaDate.java

@Override
public boolean isSupported(final TemporalField field) {
    return internal.isSupported(field) || field.equals(ChronoField.OFFSET_SECONDS)
            || field.equals(ChronoField.INSTANT_SECONDS);
}

From source file:msi.gama.util.GamaDate.java

@Override
public long getLong(final TemporalField field) {
    if (internal.isSupported(field)) {
        return internal.getLong(field);
    }/* w ww . java 2  s  .  c om*/
    if (field.equals(ChronoField.OFFSET_SECONDS)) {
        // If no offset or time zone is supplied, we assume it is the zone of the modeler
        return GamaDateType.DEFAULT_OFFSET_IN_SECONDS.getTotalSeconds();
    }
    if (field.equals(ChronoField.INSTANT_SECONDS)) {
        return GamaDateType.EPOCH.until(internal, ChronoUnit.SECONDS);
    }
    return 0l;

}