public interface TimeStruct
Specifies the time component of date and time values specified according to Coordinated Universal Time (UTC), including hour, minute, second and 1/250th of a second. The time structure is itself a component of a timestamp.
To make values of this type, use the following methods from the MAJ forge:
Forge.makeTime(byte, byte, byte) and
Forge.makeTime(byte, byte, byte, byte);Calendar value:
Forge.makeTime(java.util.Calendar);Forge.timeNow();toString():
Forge.parseTime(String).TimeStamp,
DateStruct,
TypeDefinitions.TimeStruct| Modifier and Type | Method and Description |
|---|---|
TimeStruct |
clone()
Create a cloned copy of this time value.
|
byte |
getFraction()
Returns the fractions of a second component of the time value, measured in 1/250ths of
a second..
|
byte |
getHour()
Returns the hours component of the time value.
|
byte |
getMinute()
Returns the minutes component of the time value.
|
byte |
getSecond()
Returns the seconds component of the time value.
|
void |
setFraction(byte fraction)
Sets the fractions of a second component of the time value, meansured in 1/250ths of a
second and so in the range 0 to 249.
|
void |
setHour(byte hour)
Sets the hours component of the time value, in the range 0 to 23.
|
void |
setMinute(byte minute)
Sets the minutes component of the time value, in the range 0 to 59.
|
void |
setSecond(byte second)
Sets the second component of the time value, normally in the range 0 to 59.
|
void |
setTime(byte hour,
byte minute,
byte second)
Set the values of the time structure using an hour, minute and second values
provided.
|
void |
setTime(byte hour,
byte minute,
byte second,
byte fraction)
Sets all the values of the time structure using the hour, minute, second and
fraction of a second values provided.
|
String |
toString()
Formats a UTC-style string representation of the time structure's value, including the
timezone offset.
|
void setTime(@UInt8 byte hour, @UInt8 byte minute, @UInt8 byte second) throws IllegalArgumentException
Set the values of the time structure using an hour, minute and second values provided. The fraction of the second represented is set to be 0.
hour - Hours component of the time value, represented in 24-hour clock format.minute - Minutes component of the time value.second - Seconds component of the time value.IllegalArgumentException - One or more of the values is outside the acceptable
range for a time value.void setTime(@UInt8 byte hour, @UInt8 byte minute, @UInt8 byte second, @UInt8 byte fraction) throws IllegalArgumentException
Sets all the values of the time structure using the hour, minute, second and fraction of a second values provided.
hour - Hours component of the time value, represented in 24-hour clock format.minute - Minutes component of the time value.second - Seconds component of the time value.fraction - Fractions of a second component of the time value, measured in
1/250ths of a second.IllegalArgumentException - One or more of the values is outside the acceptable
range for a time value.@UInt8 byte getFraction()
Returns the fractions of a second component of the time value, measured in 1/250ths of a second..
void setFraction(@UInt8 byte fraction) throws IllegalArgumentException
Sets the fractions of a second component of the time value, meansured in 1/250ths of a second and so in the range 0 to 249.
fraction - Fractions of a second component of the time value.IllegalArgumentException - The fractions of a second value is outside the acceptable
range.@UInt8 byte getHour()
Returns the hours component of the time value.
void setHour(@UInt8 byte hour) throws IllegalArgumentException
Sets the hours component of the time value, in the range 0 to 23.
hour - Hours component of the time value.IllegalArgumentException - The hours value is outside the acceptable range.@UInt8 byte getMinute()
Returns the minutes component of the time value.
void setMinute(@UInt8 byte minute) throws IllegalArgumentException
Sets the minutes component of the time value, in the range 0 to 59.
minute - Minutes component of the time value.IllegalArgumentException - The minute value is outside the acceptable range.@UInt8 byte getSecond()
Returns the seconds component of the time value. Note that advanced implementations may allow for very occasional leap second values of 60 or 61.
void setSecond(@UInt8 byte second) throws IllegalArgumentException
Sets the second component of the time value, normally in the range 0 to 59. Note that advanced implementations may allow for very occasional leap second values of 60 or 61.
second - Seconds component of the time value.IllegalArgumentException - The second value is outside the acceptable range.TimeStruct clone()
Create a cloned copy of this time value.
String toString()
Formats a UTC-style string representation of the time structure's value, including the
timezone offset. The format used is "HH:mm:ss.SSSZ", where:
The representation created by this method can be converted back to a time value by the
Forge.parseTime(String) method.
toString in class ObjectForge.parseTime(String),
SimpleDateFormat(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.