java.lang.Object
org.elasticsearch.core.TimeValue
- All Implemented Interfaces:
Comparable<TimeValue>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintlongdays()doubledaysFrac()longduration()booleanlonggetDays()doublelonggetHours()doublelongdoublelongdoublelongdoublelonggetNanos()longdoubleinthashCode()longhours()doublelongmicros()doublelongmillis()doublestatic TimeValuelongminutes()doublelongnanos()static longnsecToMSec(long ns) static TimeValueparseTimeValue(String sValue, String settingName) static TimeValueparseTimeValue(String sValue, TimeValue defaultValue, String settingName) longseconds()doubletimeUnit()static TimeValuetimeValueDays(long days) static TimeValuetimeValueHours(long hours) static TimeValuetimeValueMillis(long millis) static TimeValuetimeValueMinutes(long minutes) static TimeValuetimeValueNanos(long nanos) static TimeValuetimeValueSeconds(long seconds) toHumanReadableString(int fractionPieces) toString()
-
Field Details
-
NSEC_PER_MSEC
public static final long NSEC_PER_MSECHow many nano-seconds in one milli-second -
MINUS_ONE
-
ZERO
-
MAX_VALUE
-
THIRTY_SECONDS
-
ONE_MINUTE
-
-
Constructor Details
-
TimeValue
public TimeValue(long millis) -
TimeValue
-
-
Method Details
-
timeValueNanos
-
timeValueMillis
-
timeValueSeconds
-
timeValueMinutes
-
timeValueHours
-
timeValueDays
-
min
- Returns:
- the
TimeValueobject that has the least duration.
-
timeUnit
- Returns:
- the unit used for the this time value, see
duration()
-
duration
public long duration()- Returns:
- the number of
timeUnit()units this value contains
-
nanos
public long nanos() -
getNanos
public long getNanos() -
micros
public long micros() -
getMicros
public long getMicros() -
millis
public long millis() -
getMillis
public long getMillis() -
seconds
public long seconds() -
getSeconds
public long getSeconds() -
minutes
public long minutes() -
getMinutes
public long getMinutes() -
hours
public long hours() -
getHours
public long getHours() -
days
public long days() -
getDays
public long getDays() -
microsFrac
public double microsFrac() -
getMicrosFrac
public double getMicrosFrac() -
millisFrac
public double millisFrac() -
getMillisFrac
public double getMillisFrac() -
secondsFrac
public double secondsFrac() -
getSecondsFrac
public double getSecondsFrac() -
minutesFrac
public double minutesFrac() -
getMinutesFrac
public double getMinutesFrac() -
hoursFrac
public double hoursFrac() -
getHoursFrac
public double getHoursFrac() -
daysFrac
public double daysFrac() -
getDaysFrac
public double getDaysFrac() -
toString
Returns aStringrepresentation of the currentTimeValue. Note that this method might produce fractional time values (ex 1.6m) which cannot be parsed by method likeparse(String, String, String, String). Also note that the maximum string value that will be generated is106751.9ddue to the way that values are internally converted to nanoseconds (106751.9 days is Long.MAX_VALUE nanoseconds) -
toHumanReadableString
Returns aStringrepresentation of the currentTimeValue. Note that this method might produce fractional time values (ex 1.6m) which cannot be parsed by method likeparse(String, String, String, String). The number of fractional decimals (up to 10 maximum) are truncated to the number of fraction pieces specified. Also note that the maximum string value that will be generated is106751.9ddue to the way that values are internally converted to nanoseconds (106751.9 days is Long.MAX_VALUE nanoseconds)- Parameters:
fractionPieces- the number of decimal places to include
-
getStringRep
-
parseTimeValue
- Parameters:
sValue- Value to parse, which may not benull.settingName- Name of the parameter or setting. On invalid input, this value is included in the exception message. Otherwise, this parameter is unused.- Returns:
- The
TimeValuewhich the input string represents.
-
parseTimeValue
public static TimeValue parseTimeValue(@Nullable String sValue, TimeValue defaultValue, String settingName) - Parameters:
sValue- Value to parse, which may benull.defaultValue- Value to return ifsValueisnull.settingName- Name of the parameter or setting. On invalid input, this value is included in the exception message. Otherwise, this parameter is unused.- Returns:
- The
TimeValuewhich the input string represents, ordefaultValueif the input isnull.
-
equals
-
hashCode
public int hashCode() -
nsecToMSec
public static long nsecToMSec(long ns) -
compareTo
- Specified by:
compareToin interfaceComparable<TimeValue>
-