/** * Method returns a new Timestamp object with the current system time. * * Note: The Timestamp type uses microseconds since January 1st, 1970 in UTC time as physical unit. * * @return the generated timestamp object representing the current time. */ public static Timestamp getCurrentTimestamp() { return TimestampJavaTimeTransform.transform(System.currentTimeMillis()); }
/** * Generate an interval which begins now and has an end times 15 minutes from now. * * @param validityTime the time in milli seconds how long the interval should go from now * @return the above described interval */ public static Interval getValidityInterval(final long validityTime) { long currentTime = System.currentTimeMillis(); Interval.Builder validityInterval = Interval.newBuilder(); validityInterval.setBegin(TimestampJavaTimeTransform.transform(currentTime)); validityInterval.setEnd(TimestampJavaTimeTransform.transform(currentTime + validityTime)); return validityInterval.build(); } }
messageOrBuilder.getClass().getMethod(SET + TIMESTEMP_FIELD, Timestamp.class).invoke(messageOrBuilder, TimestampJavaTimeTransform.transform(milliseconds)); return messageOrBuilder; builder.getClass().getMethod(SET + TIMESTEMP_FIELD, Timestamp.class).invoke(builder, TimestampJavaTimeTransform.transform(milliseconds)); return (M) builder.getClass().getMethod("build").invoke(builder); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException ex) {
/** * Create an interval which start now and ends after the maximum of MIN_ALLCOCATION_TIME_MILLI * and the executionTimePeriod. * Updates the executionTimePeriod of the given actionDescription. * * @param actionDescription actionDescription * @return an Interval generated as described above */ public static Interval getAllocationInterval(final ActionDescription.Builder actionDescription) { Interval.Builder interval = Interval.newBuilder(); actionDescription.setExecutionTimePeriod(Math.min(actionDescription.getExecutionTimePeriod(), actionDescription.getExecutionValidity().getMillisecondsSinceEpoch() - System.currentTimeMillis())); interval.setBegin(TimestampProcessor.getCurrentTimestamp()); interval.setEnd(TimestampJavaTimeTransform.transform(System.currentTimeMillis() + Math.max(MIN_ALLOCATION_TIME_MILLI, actionDescription.getExecutionTimePeriod()))); return interval.build(); }
lastMovementValueLabel.setText("Never"); } else { lastMovementValueLabel.setText(dateFormat.format(new Date(TimestampJavaTimeTransform.transform(getProviderService().getMotionState().getLastMotion()))));
lastPresenceValueLabel.setText("Never"); } else { lastPresenceValueLabel.setText(dateFormat.format(new Date(TimestampJavaTimeTransform.transform(getProviderService().getPresenceState().getLastPresence()))));
final Timestamp timestamp = new Timestamp(TimestampJavaTimeTransform.transform(stateTimestamp)); final String timestampLiteral = StringModifier.convertToLiteral(dateFormat.format(timestamp), XsdType.DATE_TIME);