org.opennms.core.utils
Class TimeConverter
java.lang.Object
org.opennms.core.utils.TimeConverter
public class TimeConverter
- extends Object
This class contains static functions used to convert time related string
values into numeric values to be used in computations.
- Version:
- CVS 1.1.1.1
- Author:
- Mike , OpenNMS
|
Method Summary |
static long |
convertToMillis(String valueToConvert)
Converts the passed time string to a time value that is measured in
milliseconds. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TimeConverter
public TimeConverter()
convertToMillis
public static long convertToMillis(String valueToConvert)
throws NumberFormatException
Converts the passed time string to a time value that is measured in
milliseconds. The following extension are considered when converting the
string:
| Extension |
Conversion Value |
| us |
Microseconds |
| ms |
Milliseconds |
| s |
Seconds |
| m |
Minutes |
| h |
Hours |
| d |
Days |
A number entered with out any units is considered to be in milliseconds.
- Parameters:
valueToConvert - The string to convert to milliseconds.
- Returns:
- Returns the string converted to a millisecond value.
- Throws:
NumberFormatException - Thrown if the string is malformed and a number cannot be
extracted from the value.
Copyright © 2009. All Rights Reserved.