Examples of toInstant()


Examples of org.threeten.bp.ZonedDateTime.toInstant()

    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final HistoricalTimeSeriesSource timeSeriesSource = OpenGammaExecutionContext.getHistoricalTimeSeriesSource(executionContext);
    final ConfigSource configSource = OpenGammaExecutionContext.getConfigSource(executionContext);
    final String idName = desiredValue.getConstraint(ValuePropertyNames.CURVE);
    final String curveName = idName;
    final CurveSpecification curveSpecification = CurveUtils.getCurveSpecification(now.toInstant(), configSource, now.toLocalDate(), curveName);
    final String dataField = desiredValue.getConstraint(HistoricalTimeSeriesFunctionUtils.DATA_FIELD_PROPERTY);
    final String resolutionKey;
    final Set<String> resolutionKeyConstraint = desiredValue.getConstraints().getValues(HistoricalTimeSeriesFunctionUtils.RESOLUTION_KEY_PROPERTY);
    if (resolutionKeyConstraint == null || resolutionKeyConstraint.size() != 1) {
      resolutionKey = "Null";
View Full Code Here

Examples of org.threeten.bp.ZonedDateTime.toInstant()

  public void testDifferenceInYears() {
    final ZonedDateTime startDate = ZonedDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC);
    final ZonedDateTime endDate = ZonedDateTime.of(LocalDateTime.of(2001, 1, 1, 0, 0), ZoneOffset.UTC);
    try {
      DateUtils.getDifferenceInYears((Instant) null, endDate.toInstant());
      fail();
    } catch (final IllegalArgumentException e) {
      // Expected
    }
    try {
View Full Code Here

Examples of org.threeten.bp.ZonedDateTime.toInstant()

      fail();
    } catch (final IllegalArgumentException e) {
      // Expected
    }
    final double leapYearDays = 366;
    assertEquals(DateUtils.getDifferenceInYears(startDate.toInstant(), endDate.toInstant()) * DateUtils.DAYS_PER_YEAR / leapYearDays, 1, EPS);
    try {
      DateUtils.getDifferenceInYears(null, endDate.toInstant(), leapYearDays);
      fail();
    } catch (final IllegalArgumentException e) {
      // Expected
View Full Code Here

Examples of org.threeten.bp.ZonedDateTime.toInstant()

      // Expected
    }
    final double leapYearDays = 366;
    assertEquals(DateUtils.getDifferenceInYears(startDate.toInstant(), endDate.toInstant()) * DateUtils.DAYS_PER_YEAR / leapYearDays, 1, EPS);
    try {
      DateUtils.getDifferenceInYears(null, endDate.toInstant(), leapYearDays);
      fail();
    } catch (final IllegalArgumentException e) {
      // Expected
    }
    try {
View Full Code Here

Examples of org.threeten.bp.ZonedDateTime.toInstant()

      DateUtils.getDifferenceInYears(startDate.toInstant(), null, leapYearDays);
      fail();
    } catch (final IllegalArgumentException e) {
      // Expected
    }
    assertEquals(DateUtils.getDifferenceInYears(startDate.toInstant(), endDate.toInstant(), leapYearDays), 1, EPS);
  }

  public void testDateOffsetWithYearFraction() {
    final ZonedDateTime startDate = ZonedDateTime.of(LocalDateTime.of(2001, 1, 1, 0, 0), ZoneOffset.UTC);
    final ZonedDateTime offsetDateWithFinancialYearDefinition = ZonedDateTime.of(LocalDateTime.of(2002, 1, 1, 6, 0), ZoneOffset.UTC);
View Full Code Here

Examples of org.threeten.bp.ZonedDateTime.toInstant()

    } catch (final IllegalArgumentException e) {
      // Expected
    }
    assertEquals(DateUtils.getDateOffsetWithYearFraction(startDate.toInstant(), 1), offsetDateWithFinancialYearDefinition.toInstant());
    assertEquals(DateUtils.getDateOffsetWithYearFraction(startDate, 1), offsetDateWithFinancialYearDefinition);
    assertEquals(DateUtils.getDateOffsetWithYearFraction(startDate.toInstant(), 1, daysPerYear), endDate.toInstant());
    assertEquals(DateUtils.getDateOffsetWithYearFraction(startDate, 1, daysPerYear), endDate);
  }

  public void testUTCDate() {
    final int year = 2009;
View Full Code Here

Examples of org.threeten.bp.ZonedDateTime.toInstant()

        final ConfigSource configSource = OpenGammaExecutionContext.getConfigSource(executionContext);
        final String idName = desiredValue.getConstraint(ValuePropertyNames.CURVE);
        String curveName;
        try {
          curveName = "SAMEDAY_" + idName;
          curveSpecification = CurveUtils.getCurveSpecification(now.toInstant(), configSource, now.toLocalDate(), curveName);
        } catch (final Exception e) {
          curveName = idName;
          curveSpecification = CurveUtils.getCurveSpecification(now.toInstant(), configSource, now.toLocalDate(), idName);
        }
View Full Code Here

Examples of org.threeten.bp.ZonedDateTime.toInstant()

        try {
          curveName = "SAMEDAY_" + idName;
          curveSpecification = CurveUtils.getCurveSpecification(now.toInstant(), configSource, now.toLocalDate(), curveName);
        } catch (final Exception e) {
          curveName = idName;
          curveSpecification = CurveUtils.getCurveSpecification(now.toInstant(), configSource, now.toLocalDate(), idName);
        }

        final List<Tenor> tenors = new ArrayList<>();
        final List<Double> marketSpreads = new ArrayList<>();
        for (final CurveNodeWithIdentifier strip : curveSpecification.getNodes()) {
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.