List of usage examples for java.time OffsetTime getNano
public int getNano()
From source file:Main.java
public static void main(String[] args) { OffsetTime m = OffsetTime.now(); int n = m.getNano(); System.out.println(n);/* ww w .ja va2 s.c o m*/ }
From source file:io.sqp.core.types.SqpTimeTest.java
@Test public void CanDecodeFromJson() throws Exception { String content = "[[13, 52, 5, 123456],7260]"; ObjectMapper mapper = JacksonObjectMapperFactory.objectMapper(DataFormat.Text); Object timeObj = mapper.readValue(content, Object.class); SqpTime sqpTime = SqpTime.fromJsonFormatValue(timeObj); assertThat(sqpTime.hasOffset(), is(true)); OffsetTime offsetTime = sqpTime.asOffsetTime(); assertThat(offsetTime.getHour(), is(13)); assertThat(offsetTime.getMinute(), is(52)); assertThat(offsetTime.getSecond(), is(5)); assertThat(offsetTime.getNano(), is(123456)); assertThat(offsetTime.getOffset().getTotalSeconds(), is(7260)); }
From source file:io.sqp.core.types.SqpTimeTest.java
@Test public void CanDecodeFromJsonWithoutOffset() throws Exception { String content = "[[13, 52, 5, 123456]]"; ObjectMapper mapper = JacksonObjectMapperFactory.objectMapper(DataFormat.Text); Object timeObj = mapper.readValue(content, Object.class); SqpTime sqpTime = SqpTime.fromJsonFormatValue(timeObj); assertThat(sqpTime.hasOffset(), is(false)); OffsetTime offsetTime = sqpTime.asOffsetTime(); assertThat(offsetTime.getHour(), is(13)); assertThat(offsetTime.getMinute(), is(52)); assertThat(offsetTime.getSecond(), is(5)); assertThat(offsetTime.getNano(), is(123456)); assertThat(offsetTime.getOffset().getTotalSeconds(), is(0)); }