List of utility methods to do TimeUnit Convert
double | toSeconds(long value, TimeUnit unit) to Seconds if (unit.ordinal() >= TimeUnit.SECONDS.ordinal()) { return TimeUnit.SECONDS.convert(value, unit); return value / (double) unit.convert(1, TimeUnit.SECONDS); |
String | toSIAbbreviation(final TimeUnit timeUnit) Return the SI abbreviation from the given TimeUnit name. if (timeUnit == null) { return ""; switch (timeUnit) { case DAYS: return "d"; case HOURS: return "h"; ... |
String | toString(TimeUnit unit) to String switch (unit) { case HOURS: case DAYS: case MINUTES: case SECONDS: return unit.toString().substring(0, 1).toLowerCase(); case MILLISECONDS: return "ms"; ... |
String | toString(TimeUnit unit) to String return names[unit.ordinal()];
|
long | toTime(final String value, final TimeUnit inputUnit, final TimeUnit outUnit) toTime. final String[] parsed = parseTime(value.trim()); return outUnit.convert(Long.parseLong(parsed[0].trim().trim()), unitFor(parsed[1].trim(), inputUnit)); |
String | toTimePrecision(final TimeUnit t) Convert from a TimeUnit to a influxDB timeunit String. switch (t) { case HOURS: return "h"; case MINUTES: return "m"; case SECONDS: return "s"; case MILLISECONDS: ... |
String | toTimeUnits(long time) to Time Units time = Math.abs(time); final StringBuilder sb = new StringBuilder(50); final long days = time / TimeUnit.DAYS.toMillis(1); if (days > 0) { time -= (days * TimeUnit.DAYS.toMillis(1)); sb.append(days).append("D "); final long hours = time / TimeUnit.HOURS.toMillis(1); ... |