time value to support parsing days as well
This commit is contained in:
parent
088e0b5a64
commit
4049da97fb
|
@ -34,7 +34,7 @@ import java.io.Serializable;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kimchy (Shay Banon)
|
* @author kimchy (shay.banon)
|
||||||
*/
|
*/
|
||||||
public class TimeValue implements Serializable, Streamable {
|
public class TimeValue implements Serializable, Streamable {
|
||||||
|
|
||||||
|
@ -231,8 +231,10 @@ public class TimeValue implements Serializable, Streamable {
|
||||||
millis = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * 1000);
|
millis = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * 1000);
|
||||||
} else if (sValue.endsWith("m")) {
|
} else if (sValue.endsWith("m")) {
|
||||||
millis = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * 60 * 1000);
|
millis = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * 60 * 1000);
|
||||||
} else if (sValue.endsWith("H")) {
|
} else if (sValue.endsWith("H") || sValue.endsWith("h")) {
|
||||||
millis = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * 60 * 60 * 1000);
|
millis = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * 60 * 60 * 1000);
|
||||||
|
} else if (sValue.endsWith("d")) {
|
||||||
|
millis = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * 24 * 60 * 60 * 1000);
|
||||||
} else {
|
} else {
|
||||||
millis = Long.parseLong(sValue);
|
millis = Long.parseLong(sValue);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue