Package uk.ac.manchester.spinnaker.utils
Class UnitConstants
java.lang.Object
uk.ac.manchester.spinnaker.utils.UnitConstants
Constants relating to physical units.
- Author:
- Christian-B, Donal Fellows
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The number of bytes in a kilobyte.static final int
The number of bytes in a megabyte.static final int
The number of megahertz in each hertz.static final int
The number of megahertz in each kilohertz.static final int
The number of minute per hour.static final int
The number of milliseconds per second.static final double
The number of nanoseconds per millisecond.static final int
The number of nanoseconds per second.static final double
The number of nanoseconds per microsecond.static final int
The number of second per minute. -
Method Summary
Modifier and TypeMethodDescriptionstatic 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:
-
MEGAHERTZ_PER_HERTZ
public static final int MEGAHERTZ_PER_HERTZThe number of megahertz in each hertz.- See Also:
-
MSEC_PER_SEC
public static final int MSEC_PER_SECThe number of milliseconds per second.- See Also:
-
NSEC_PER_SEC
public static final int NSEC_PER_SECThe number of nanoseconds per second.- See Also:
-
SEC_PER_MINUTE
public static final int SEC_PER_MINUTEThe number of second per minute.- See Also:
-
MINUTE_PER_HOUR
public static final int MINUTE_PER_HOURThe number of minute per hour.- See Also:
-
NSEC_PER_USEC
public static final double NSEC_PER_USECThe number of nanoseconds per microsecond.- See Also:
-
NSEC_PER_MSEC
public static final double NSEC_PER_MSECThe number of nanoseconds per millisecond.- See Also:
-
KILOBYTE
public static final int KILOBYTEThe number of bytes in a kilobyte. Properly a "kibibyte", but that's a horrible term.- See Also:
-
MEGABYTE
public static final int MEGABYTEThe number of bytes in a megabyte. Properly a "mibibyte", but that's a horrible term.- See Also:
-
-
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.
-