List of usage examples for java.time Instant ofEpochSecond
public static Instant ofEpochSecond(long epochSecond, long nanoAdjustment)
From source file:Main.java
public static void main(String[] args) { Instant instant = Instant.ofEpochSecond(123123123123L, 123123); System.out.println(instant.getEpochSecond()); }
From source file:com.aerospike.delivery.db.aerospike.AerospikeDatabase.java
static Instant longsToInstant(Record record, String binName) { Object value = record.getValue(binName); if (value == null) { return null; }/*ww w . java 2 s . c om*/ long[] parts = (long[]) value; return Instant.ofEpochSecond(parts[0], parts[1]); }
From source file:org.openmhealth.shim.googlefit.mapper.GoogleFitDataPointMapper.java
/** * Converts a nanosecond timestamp from the Google Fit API into an offset datetime value. * * @param unixEpochNanosString the timestamp directly from the Google JSON document * @return an offset datetime object representing the input timestamp */// w w w . j a v a 2 s .com public OffsetDateTime convertGoogleNanosToOffsetDateTime(String unixEpochNanosString) { return OffsetDateTime.ofInstant(Instant.ofEpochSecond(0, Long.parseLong(unixEpochNanosString)), ZoneId.of("Z")); }