List of utility methods to do TimeUnit Convert
double | convert(double t, TimeUnit sourceUnit, TimeUnit destinationUnit) convert switch (sourceUnit) { case NANOSECONDS: return nanosToUnit(t, destinationUnit); case MICROSECONDS: return microsToUnit(t, destinationUnit); case MILLISECONDS: return millisToUnit(t, destinationUnit); case SECONDS: ... |
long | convert(long time, TimeUnit src, TimeUnit dst) Converts the given time and TimeUnit to an another TimeUnit . return dst.convert(time, src);
|
double | convert(long time, TimeUnit unitIn, TimeUnit unitOut) convert return (double) unitIn.toNanos(time) / (double) unitOut.toNanos(1); |
long | convert(TimeUnit unitTo, TimeUnit unitFrom, long cnt) convert return unitTo.convert(unitFrom.toMillis(cnt), TimeUnit.MILLISECONDS);
|
long | convertReportingPeriod(long profilePeriod, TimeUnit profileTimeUnit, long reportingPeriod, TimeUnit reportingTimeUnit) Convert a reporting period into the time scale of a profiling period long convertedReportingPeriod = profileTimeUnit.convert(reportingPeriod, reportingTimeUnit); if (convertedReportingPeriod <= profilePeriod) { return 1; return convertedReportingPeriod / profilePeriod; |
long | convertTo(long a, TimeUnit from, TimeUnit to) convert To switch (to) { case NANOSECONDS: return from.toNanos(a); case MICROSECONDS: return from.toMicros(a); case MILLISECONDS: return from.toMillis(a); case SECONDS: ... |
double | convertToDouble(long fromTime, TimeUnit fromTimeUnit, TimeUnit toTimeUnit) convert To Double return (fromTimeUnit.ordinal() >= toTimeUnit.ordinal()) ? (double) toTimeUnit.convert(fromTime, fromTimeUnit) : ((double) fromTime) / fromTimeUnit.convert(1, toTimeUnit); |
long | convertToMillis(long waitTime, TimeUnit timeUnit) convert To Millis return timeUnit.toMillis(waitTime);
|
long | convertToMilliseconds(TimeUnit timeUnit, long seed) convert To Milliseconds switch (timeUnit) { case MILLISECONDS: return seed; case SECONDS: return fromSeconds(seed); case MINUTES: return fromMinutes(seed); case HOURS: ... |
int | convertToSecond(int interval, TimeUnit unit) convert To Second switch (unit) { case DAYS: return interval * DateTimeConstants.SECONDS_PER_DAY; case HOURS: return interval * DateTimeConstants.SECONDS_PER_HOUR; case MINUTES: return interval * DateTimeConstants.SECONDS_PER_MINUTE; case SECONDS: ... |