Package uk.ac.manchester.spinnaker.utils
Class UnitConstants
java.lang.Object
uk.ac.manchester.spinnaker.utils.UnitConstants
public final class UnitConstants extends Object
Constants relating to physical units.
- Author:
- Christian-B, Donal Fellows
-
Field Summary
Fields Modifier and Type Field Description static int
KILOBYTE
The number of bytes in a kilobyte.static int
MEGABYTE
The number of bytes in a megabyte.static int
MEGAHERTZ_PER_HERTZ
The number of megahertz in each hertz.static int
MEGAHERTZ_PER_KILOHERTZ
The number of megahertz in each kilohertz.static int
MINUTE_PER_HOUR
The number of minute per hour.static int
MSEC_PER_SEC
The number of milliseconds per second.static double
NSEC_PER_MSEC
The number of nanoseconds per millisecond.static int
NSEC_PER_SEC
The number of nanoseconds per second.static double
NSEC_PER_USEC
The number of nanoseconds per microsecond.static int
SEC_PER_MINUTE
The number of second per minute. -
Method Summary
Modifier and Type Method Description static String
formatDuration(long durationInMillis)
Formats a duration with hours, minutes seconds and milliseconds as required.
-
Field Details
-
MEGAHERTZ_PER_KILOHERTZ
public static final int MEGAHERTZ_PER_KILOHERTZThe number of megahertz in each kilohertz.- See Also:
- Constant Field Values
-
MEGAHERTZ_PER_HERTZ
public static final int MEGAHERTZ_PER_HERTZThe number of megahertz in each hertz.- See Also:
- Constant Field Values
-
MSEC_PER_SEC
public static final int MSEC_PER_SECThe number of milliseconds per second.- See Also:
- Constant Field Values
-
NSEC_PER_SEC
public static final int NSEC_PER_SECThe number of nanoseconds per second.- See Also:
- Constant Field Values
-
SEC_PER_MINUTE
public static final int SEC_PER_MINUTEThe number of second per minute.- See Also:
- Constant Field Values
-
MINUTE_PER_HOUR
public static final int MINUTE_PER_HOURThe number of minute per hour.- See Also:
- Constant Field Values
-
NSEC_PER_USEC
public static final double NSEC_PER_USECThe number of nanoseconds per microsecond.- See Also:
- Constant Field Values
-
NSEC_PER_MSEC
public static final double NSEC_PER_MSECThe number of nanoseconds per millisecond.- See Also:
- Constant Field Values
-
KILOBYTE
public static final int KILOBYTEThe number of bytes in a kilobyte. Properly a "kibibyte", but that's a horrible term.- See Also:
- Constant Field Values
-
MEGABYTE
public static final int MEGABYTEThe number of bytes in a megabyte. Properly a "mibibyte", but that's a horrible term.- See Also:
- Constant Field Values
-
-
Method Details
-
formatDuration
Formats a duration with hours, minutes seconds and milliseconds as required.- Parameters:
durationInMillis
- A time interval in milliseconds- Returns:
- A formatted String with only the relative units.
-