Examples of instant()


Examples of java.time.Clock.instant()

        // get the current time
        Clock clock = Clock.systemDefaultZone();
        long t0 = clock.millis();
        System.out.println(t0);

        Instant instant = clock.instant();
        Date legacyDate = Date.from(instant);


        ZoneId zone1 = ZoneId.of("Europe/Berlin");
        ZoneId zone2 = ZoneId.of("Brazil/East");
View Full Code Here

Examples of java.time.Clock.instant()

  @Test
  public void testClockFixed() throws Exception {
    // A clock which always returns a fixed date/time - in this case 'now', in UTC
    Clock clock = Clock.fixed(Instant.now(), ZoneId.of("UTC"));

    Instant instant1 = clock.instant();
    Thread.sleep(1);
    Instant instant2 = clock.instant();

    assertThat(instant2, is(instant1));
  }
View Full Code Here

Examples of java.time.Clock.instant()

    // A clock which always returns a fixed date/time - in this case 'now', in UTC
    Clock clock = Clock.fixed(Instant.now(), ZoneId.of("UTC"));

    Instant instant1 = clock.instant();
    Thread.sleep(1);
    Instant instant2 = clock.instant();

    assertThat(instant2, is(instant1));
  }

  /**
 
View Full Code Here

Examples of java.time.Clock.instant()

    Thread.sleep(1);
    long currentTimeMillis = Instant.now().toEpochMilli();
   
    // The offset clock should return a date/time, behind the current date/time
    assertThat(clock.instant().toEpochMilli(), lessThan(currentTimeMillis));
  }
}
View Full Code Here

Examples of org.threeten.bp.Clock.instant()

    final CreditSecurityToIdentifierVisitor identifierVisitor = new CreditSecurityToIdentifierVisitor(OpenGammaExecutionContext.getSecuritySource(executionContext));
    final FinancialSecurity security = (FinancialSecurity) target.getPosition().getSecurity();
    final String spreadCurveName = security.accept(identifierVisitor).getUniqueId().getValue();
    //TODO
    final String curveName = getCurvePrefix() + "_" + spreadCurveName;
    final CurveSpecification curveSpecification = CurveUtils.getCurveSpecification(snapshotClock.instant(), configSource, now, curveName);
    DoubleTimeSeries<?> fxSeries = null;
    boolean isInverse = true;
    if (!desiredCurrency.equals(currency)) {
      final Object fxSeriesObject = inputs.getValue(ValueRequirementNames.HISTORICAL_FX_TIME_SERIES);
      if (fxSeriesObject == null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.