/** * @return the duration of this timespan in milliseconds */ public long getDurationInMilliseconds() { // 100% equivalent to getDuration(TimeUnit.MILLISECOND) but faster! return getDuration() * getTimeUnit().getMillisecondsCount(); }
private boolean isDockerHostSet() { return Strings.isNotNullOrEmpty(SystemEnvironmentVariables.getEnvironmentOrPropertyVariable(DOCKER_HOST)); }
/** * Convenient call when providing minutes * * @return the timespan */ public static Timespan minutes(long minutes) { return new Timespan(minutes, TimeUnit.MINUTE); }
/** * @return a (potentially new) version of this timestamp where the unit is * {@link TimeUnit#MILLISECOND}. */ public Timespan toMillisecondsTimespan() { if (getTimeUnit() == TimeUnit.MILLISECOND) { return this; } return new Timespan(getDurationInMilliseconds(), TimeUnit.MILLISECOND); }
/** * Shortcut for creating a timespan and then retrieving the value in milliseconds. * * @param timespan * the timespan as a string * * @return the value in milliseconds */ public static long toMilliseconds(String timespan) { return parseTimespan(timespan).getDurationInMilliseconds(); } }
/** * @param timeUnit * the unit of time you want this timespan ass * * @return the duration of this timespan expressed in the time unit provided. Note that all * units below timeUnit will be truncated! (ex: 3h20m45s will return 3 if timeUnit=HOUR). */ public long getDuration(TimeUnit timeUnit) { return truncate(timeUnit).getDuration(); }
/** * Synonym. * * @see #parseTimespan(String) */ public static Timespan valueOf(String timespan) { return parseTimespan(timespan); }
/** * @param baseMillis * the starting point * * @return baseMillis - this timespan */ public long pastTimeMillis(long baseMillis) { return baseMillis - getDurationInMilliseconds(); }
/** * @return the duration of this timespan expressed in hours. If m/s/ms are present, * they will be truncated! */ public long getDurationInHours() { return getDuration(TimeUnit.HOUR); }
private boolean isDockerMachineNameSet() { return Strings.isNotNullOrEmpty(SystemEnvironmentVariables.getEnvironmentOrPropertyVariable(DOCKER_MACHINE_NAME)); }
/** * @return the duration of this timespan in milliseconds */ public long getDurationInMilliseconds() { // 100% equivalent to getDuration(TimeUnit.MILLISECOND) but faster! return getDuration() * getTimeUnit().getMillisecondsCount(); }
/** * Convenient call when providing milliseconds * * @return the timespan */ public static Timespan milliseconds(long milliseconds) { return new Timespan(milliseconds); }
/** * Synonym. * * @see #parseTimespan(String) */ public static Timespan parse(String timespan) { return parseTimespan(timespan); }
/** * @param baseMillis * the starting point * * @return baseMillis - this timespan */ public long pastTimeMillis(long baseMillis) { return baseMillis - getDurationInMilliseconds(); }
private boolean isDockerMachineNameSet() { return Strings.isNotNullOrEmpty(SystemEnvironmentVariables.getEnvironmentOrPropertyVariable(DOCKER_MACHINE_NAME)); }
/** * Convenient call when providing seconds * * @return the timespan */ public static Timespan seconds(long seconds) { return new Timespan(seconds, TimeUnit.SECOND); }
private boolean isDockerCertPathSet() { return Strings.isNotNullOrEmpty(SystemEnvironmentVariables.getEnvironmentOrPropertyVariable(DOCKER_CERT_PATH)); }
/** * Convenient call when providing milliseconds * * @return the timespan */ public static Timespan milliseconds(long milliseconds) { return new Timespan(milliseconds); }
private boolean isDockerTlsVerifySet() { return Strings.isNotNullOrEmpty(SystemEnvironmentVariables.getEnvironmentOrPropertyVariable(DOCKER_TLS_VERIFY)); }
private boolean isDockerCertPathSet() { return Strings.isNotNullOrEmpty(SystemEnvironmentVariables.getEnvironmentOrPropertyVariable(DOCKER_CERT_PATH)); }