25package umontreal.ssj.util;
47 (
"ns",
"nanosecond", 1.0 / 3600000000000.0),
54 (
"us",
"microsecond", 1.0 / 3600000000.0),
61 (
"ms",
"millisecond", 1.0 / 3600000.0),
68 (
"s",
"second", 1.0 / 3600.0),
75 (
"min",
"minute", 1.0 / 60.0),
96 (
"w",
"week", 24.0 * 7);
98 private String shortName;
99 private String longName;
100 private transient double numHours;
102 private TimeUnit(String shortName, String longName,
double numHours) {
103 this.shortName = shortName;
104 this.longName = longName;
105 this.numHours = numHours;
161 public static double convert(
double value, TimeUnit srcUnit, TimeUnit dstUnit) {
162 double hours = value * srcUnit.
getHours();
NANOSECOND
Represents a nanosecond which has short name ns.
double getHours()
Returns this time unit represented in hours.
String toString()
Calls getLongName.
WEEK
Represents a week which has short name w.
static double convert(double value, TimeUnit srcUnit, TimeUnit dstUnit)
Converts value expressed in time unit srcUnit to a time duration expressed in dstUnit and returns the...
SECOND
Represents a second which has short name s.
String getShortName()
Returns the short name representing this unit in a string specifying a time duration.
HOUR
Represents an hour which has short name h.
MICROSECOND
Represents a microsecond which has short name us.
DAY
Represents a day which has short name d.
MINUTE
Represents a minute which has short name min.
String getLongName()
Returns the long name of this time unit.
MILLISECOND
Represents a millisecond which has short name ms.