List of usage examples for java.time Duration get
@Override public long get(TemporalUnit unit)
From source file:Main.java
public static void main(String[] args) { Duration duration = Duration.between(LocalTime.MIDNIGHT, LocalTime.NOON); System.out.println(duration.get(ChronoUnit.SECONDS)); }
From source file:com.example.oauth.AccessToken.java
@Override public int getExpiresIn() { final OffsetDateTime now = OffsetDateTime.now(); final Duration expiredIn = Duration.between(now, expiration); return (int) expiredIn.get(ChronoUnit.SECONDS); }
From source file:com.github.aptd.simulation.elements.train.CTrain.java
@Override protected final synchronized boolean updatecontinuous(final Duration p_elapsed) { switch (m_state) { case DRIVING: m_positionontrack += p_elapsed.get(ChronoUnit.SECONDS) * DRIVING_SPEED; return true; default:// ww w . j a va2s. com // making checkstyle happy } return false; }
From source file:com.github.aptd.simulation.elements.passenger.CPassenger.java
@Override protected boolean updatecontinuous(final Duration p_elapsed) { switch (m_state) { case MOVING_THROUGH_STATION: m_distancewalked += p_elapsed.get(ChronoUnit.SECONDS) * m_speedatstation; return true; case ENTERING_TRAIN: case LEAVING_TRAIN: m_dooruse += p_elapsed.get(ChronoUnit.SECONDS); return true; default:/*from ww w . j a v a2 s . c o m*/ return false; } }
From source file:com.github.aptd.simulation.elements.train.CDoor.java
@Override protected boolean updatecontinuous(final Duration p_elapsed) { switch (m_state) { case OPENING: case OPENING_SHALL_CLOSE: m_openwidth += p_elapsed.get(ChronoUnit.SECONDS) * m_openingspeed; return true; case OPEN_FREE: case OPEN_CLOSEABLE: case OPEN_FREE_SHALL_CLOSE: m_freetime += p_elapsed.get(ChronoUnit.SECONDS); return true; case CLOSING: case CLOSING_LOCKED: m_openwidth -= p_elapsed.get(ChronoUnit.SECONDS) * m_closingspeed; return true; default://from w ww.j a va2 s. c o m // making checkstyle happy } return false; }