/** * Extracts the millis from an object of this converter's type. * <p> * This implementation returns the current time. * * @param object the object to convert * @param chrono the chronology to use, which is always non-null * @return the millisecond value */ public long getInstantMillis(Object object, Chronology chrono) { return DateTimeUtils.currentTimeMillis(); }
/** * Constructs an instance set to the current system millisecond time * using the specified chronology. * <p> * If the chronology is null, <code>ISOChronology</code> * in the default time zone is used. * * @param chronology the chronology, null means ISOChronology in default zone */ public BaseDateTime(Chronology chronology) { this(DateTimeUtils.currentTimeMillis(), chronology); }
/** * Constructs an instance set to the current system millisecond time. * * @see #now() */ public Instant() { super(); iMillis = DateTimeUtils.currentTimeMillis(); }
/** * Constructs a partial with the current time, using ISOChronology in * the default zone to extract the fields. * <p> * The constructor uses the default time zone, resulting in the local time * being initialised. Once the constructor is complete, all further calculations * are performed without reference to a timezone (by switching to UTC). */ protected BasePartial() { this(DateTimeUtils.currentTimeMillis(), null); }
/** * Constructs an instance set to the current local time evaluated using * specified chronology. * <p> * If the chronology is null, ISO chronology in the default time zone is used. * Once the constructor is completed, the zone is no longer used. * * @param chronology the chronology, null means ISOChronology in default zone * @see #now(Chronology) */ public LocalDateTime(Chronology chronology) { this(DateTimeUtils.currentTimeMillis(), chronology); }
/** * Constructs an instance set to the current local time evaluated using * ISO chronology in the default zone. * <p> * Once the constructor is completed, the zone is no longer used. * * @see #now() */ public LocalDate() { this(DateTimeUtils.currentTimeMillis(), ISOChronology.getInstance()); }
/** * Constructs an instance set to the current local time evaluated using * ISO chronology in the default zone. * <p> * Once the constructor is completed, the zone is no longer used. * * @see #now() */ public LocalDateTime() { this(DateTimeUtils.currentTimeMillis(), ISOChronology.getInstance()); }
/** * Is this instant equal to the current instant * comparing solely by millisecond. * * @return true if this instant is equal to the current instant */ public boolean isEqualNow() { return isEqual(DateTimeUtils.currentTimeMillis()); }
/** * Is this time interval before the current instant. * <p> * Intervals are inclusive of the start instant and exclusive of the end. * * @return true if this time interval is before the current instant */ public boolean isBeforeNow() { return isBefore(DateTimeUtils.currentTimeMillis()); }
/** * Does this time interval contain the current instant. * <p> * Non-zero duration intervals are inclusive of the start instant and * exclusive of the end. A zero duration interval cannot contain anything. * * @return true if this time interval contains the current instant */ public boolean containsNow() { return contains(DateTimeUtils.currentTimeMillis()); }
/** * Is this time interval after the current instant. * <p> * Intervals are inclusive of the start instant and exclusive of the end. * * @return true if this time interval is after the current instant */ public boolean isAfterNow() { return isAfter(DateTimeUtils.currentTimeMillis()); }
/** * Is this instant strictly after the current instant * comparing solely by millisecond. * * @return true if this instant is strictly after the current instant */ public boolean isAfterNow() { return isAfter(DateTimeUtils.currentTimeMillis()); }
/** * Is this instant strictly before the current instant * comparing solely by millisecond. * * @return true if this instant is strictly before the current instant */ public boolean isBeforeNow() { return isBefore(DateTimeUtils.currentTimeMillis()); }
/** * Constructs an instance set to the current system millisecond time * using <code>ISOChronology</code> in the default time zone. */ public BaseDateTime() { this(DateTimeUtils.currentTimeMillis(), ISOChronology.getInstance()); }
/** * Constructs an instance set to the current local time evaluated using * ISO chronology in the default zone. * <p> * Once the constructor is completed, the zone is no longer used. * * @see #now() */ public LocalTime() { this(DateTimeUtils.currentTimeMillis(), ISOChronology.getInstance()); }
/** * Constructs an instance set to the current system millisecond time * using <code>ISOChronology</code> in the specified time zone. * <p> * If the specified time zone is null, the default zone is used. * * @param zone the time zone, null means default zone */ public BaseDateTime(DateTimeZone zone) { this(DateTimeUtils.currentTimeMillis(), ISOChronology.getInstance(zone)); }
/** * Constructs an instance set to the current local time evaluated using * ISO chronology in the specified zone. * <p> * If the specified time zone is null, the default zone is used. * Once the constructor is completed, the zone is no longer used. * * @param zone the time zone, null means default zone * @see #now(DateTimeZone) */ public LocalDate(DateTimeZone zone) { this(DateTimeUtils.currentTimeMillis(), ISOChronology.getInstance(zone)); }
/** * Gets the millisecond offset to add to UTC to get local time. * * @param instant instant to get the offset for, null means now * @return the millisecond offset to add to UTC to get local time */ public final int getOffset(ReadableInstant instant) { if (instant == null) { return getOffset(DateTimeUtils.currentTimeMillis()); } return getOffset(instant.getMillis()); }
public void prepareForRerunOf(SchedulingContext context, String latestConfigVersion) { setId(-1); if (rerunOfCounter == null) { setRerunOfCounter(counter); } this.configVersion = latestConfigVersion; setApprovedBy(context.getApprovedBy()); setLatestRun(true); resetResult(); setCreatedTime(new Timestamp(DateTimeUtils.currentTimeMillis())); jobInstances.resetJobsIds(); }
@Test public void shouldSetTheCurrentTimeAsCreationTimeForRerunOfJobs() { Stage stage = new Stage("foo-stage", new JobInstances(), "admin", null,"manual", false, false, "git-sha", new TimeProvider()); Timestamp createdTimeOfRun1 = stage.getCreatedTime(); long minuteAfter = DateTimeUtils.currentTimeMillis() + 60000; freezeTime(minuteAfter); stage.prepareForRerunOf(new DefaultSchedulingContext("admin"), "git-sha"); resetTime(); Timestamp createdTimeOfRun2 = stage.getCreatedTime(); assertNotEquals(createdTimeOfRun1, createdTimeOfRun2); assertEquals(createdTimeOfRun2, new Timestamp(minuteAfter)); }