Package org.joda.time

Examples of org.joda.time.Instant


    }

    public void testFactory_Zone_long_int() {
        GJChronology chrono = GJChronology.getInstance(TOKYO, 0L, 2);
        assertEquals(TOKYO, chrono.getZone());
        assertEquals(new Instant(0L), chrono.getGregorianCutover());
        assertEquals(2, chrono.getMinimumDaysInFirstWeek());
        assertSame(GJChronology.class, GJChronology.getInstance(TOKYO, 0L, 2).getClass());
       
        try {
            GJChronology.getInstance(TOKYO, 0L, 0);
View Full Code Here


            fail();
        } catch (IllegalArgumentException ex) {}
    }

    public void testFactory_Zone_RI() {
        GJChronology chrono = GJChronology.getInstance(TOKYO, new Instant(0L));
        assertEquals(TOKYO, chrono.getZone());
        assertEquals(new Instant(0L), chrono.getGregorianCutover());
        assertSame(GJChronology.class, GJChronology.getInstance(TOKYO, new Instant(0L)).getClass());
       
        DateTime cutover = new DateTime(1582, 10, 15, 0, 0, 0, 0, DateTimeZone.UTC);
        chrono = GJChronology.getInstance(TOKYO, null);
        assertEquals(TOKYO, chrono.getZone());
        assertEquals(cutover.toInstant(), chrono.getGregorianCutover());
View Full Code Here

        assertEquals(TOKYO, chrono.getZone());
        assertEquals(cutover.toInstant(), chrono.getGregorianCutover());
    }

    public void testFactory_Zone_RI_int() {
        GJChronology chrono = GJChronology.getInstance(TOKYO, new Instant(0L), 2);
        assertEquals(TOKYO, chrono.getZone());
        assertEquals(new Instant(0L), chrono.getGregorianCutover());
        assertEquals(2, chrono.getMinimumDaysInFirstWeek());
        assertSame(GJChronology.class, GJChronology.getInstance(TOKYO, new Instant(0L), 2).getClass());
       
        DateTime cutover = new DateTime(1582, 10, 15, 0, 0, 0, 0, DateTimeZone.UTC);
        chrono = GJChronology.getInstance(TOKYO, null, 2);
        assertEquals(TOKYO, chrono.getZone());
        assertEquals(cutover.toInstant(), chrono.getGregorianCutover());
        assertEquals(2, chrono.getMinimumDaysInFirstWeek());
       
        try {
            GJChronology.getInstance(TOKYO, new Instant(0L), 0);
            fail();
        } catch (IllegalArgumentException ex) {}
        try {
            GJChronology.getInstance(TOKYO, new Instant(0L), 8);
            fail();
        } catch (IllegalArgumentException ex) {}
    }
View Full Code Here

    try {
      if ( dt == null ) {
        dt = new DateTime();
        return true;
      }
      Duration interval = new Duration(dt, new Instant());
      dt = new DateTime();
      //  check if filter called within an interval of 1 second or less. If so, we
      //  just detected a blast. Return false to invalidate the route and dispose the
      //  message
      if ( interval.isShorterThan(Duration.standardSeconds(1)) ) {
View Full Code Here

      // Configure JSON token
      final JsonToken token = new JsonToken(signer);
      token.setAudience("Google");
      token.setParam("typ", "google/payments/inapp/item/v1");
      token.setIssuedAt(new Instant(cal.getTimeInMillis()));
      token.setExpiration(new Instant(cal.getTimeInMillis() + 60000L));

      // Configure request object
      final JsonObject request = new JsonObject();
      request.addProperty("name", "Battle Disks");
      request.addProperty("description", description);
View Full Code Here

              // Participant lists can be empty.
              wavelet.getDigest().getParticipantSize() == 0
                  ? "<unknown>"
                  : wavelet.getDigest().getParticipant(0),
              wavelet.getDigest().getTitle(),
              "" + new LocalDate(new Instant(wavelet.getDigest().getLastModifiedMillis())),
              importsInProgress.containsEntry(Pair.of(wavelet.getSourceInstance(), waveletName),
                  ImportSharingMode.PRIVATE)
                  || importsInProgress.containsEntry(Pair.of(wavelet.getSourceInstance(),
                      waveletName), ImportSharingMode.PRIVATE_UNLESS_PARTICIPANT),
              wavelet.getPrivateLocalId() == null ? null : wavelet.getPrivateLocalId().getId(),
View Full Code Here

      for (UserIndexEntry wave : waves) {
        out.add(new InboxDisplayRecord(
            wave.getObjectId(),
            // TODO(danilatos): Retrieve contact details if possible and use name not address.
            wave.getCreator().getAddress(),
            "" + new LocalDate(new Instant(wave.getLastModifiedMillis())),
            wave.getTitle().trim(),
            // TODO(danilatos): Detect if the snippet redundantly starts with the title,
            // and strip it out, if we are just displaying a folder (but don't if we
            // are displaying the context of a search query).
            wave.getSnippetHtml().trim(),
View Full Code Here

   */
  public final static String DOT_SNAPSHOT_DIR = ".snapshot";

  public static Instant newInstantFromString(String value) {
    if (value.equalsIgnoreCase(Parameters.DATE_TIME_NOW)) {
      return new Instant();
    }

    return new Instant(DATE_TIME_PARSER.parseMillis(value));
  }
View Full Code Here

  public static Period newPeriodFromString(String value) {
    return PERIOD_FORMATTER.parsePeriod(value);
  }

  public static String printDate(Date date) {
    return DATE_TIME_PRINTER.print(new Instant(date));
  }
View Full Code Here

      fromDate = newDateFromString(fromString);
      Preconditions.checkArgument(
          fromDate.getTime() < toDate.getTime(),
          "Invalid period specified: 'to' must be later than 'from'.");
    } else {
      Instant fromInstant = new Instant(toDate.getTime()).minus(window);
      fromDate = new Date(fromInstant.getMillis());
    }
    return fromDate;
  }
View Full Code Here

TOP

Related Classes of org.joda.time.Instant

Copyright © 2018 www.massapicom. 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.