public class TimeComponents extends Object implements Serializable, Comparable<TimeComponents>
Instances of this class are guaranteed to be immutable.
DateComponents
,
DateTimeComponents
,
Serialized FormModifier and Type | Field and Description |
---|---|
static TimeComponents |
H00
Constant for commonly used hour 00:00:00.
|
static TimeComponents |
H12
Constant for commonly used hour 12:00:00.
|
Constructor and Description |
---|
TimeComponents(double secondInDay)
Build a time from the second number within the day.
|
TimeComponents(int secondInDayA,
double secondInDayB)
Build a time from the second number within the day.
|
TimeComponents(int hour,
int minute,
double second)
Build a time from its clock elements.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(TimeComponents other) |
boolean |
equals(Object other) |
int |
getHour()
Get the hour number.
|
int |
getMinute()
Get the minute number.
|
double |
getSecond()
Get the seconds number.
|
double |
getSecondsInDay()
Get the second number within the day.
|
int |
hashCode() |
static TimeComponents |
parseTime(String string)
Parse a string in ISO-8601 format to build a time.
|
String |
toString()
Get a string representation of the time.
|
public static final TimeComponents H00
public static final TimeComponents H12
public TimeComponents(int hour, int minute, double second) throws IllegalArgumentException
Note that seconds between 60.0 (inclusive) and 61.0 (exclusive) are allowed
in this method, since they do occur during leap seconds introduction
in the UTC
time scale.
hour
- hour number from 0 to 23minute
- minute number from 0 to 59second
- second number from 0.0 to 61.0 (excluded)IllegalArgumentException
- if inconsistent arguments
are given (parameters out of range)public TimeComponents(double secondInDay)
secondInDay
- second number from 0.0 to Constants.JULIAN_DAY
(excluded)IllegalArgumentException
- if seconds number is out of rangepublic TimeComponents(int secondInDayA, double secondInDayB)
The second number is defined here as the sum
secondInDayA + secondInDayB
from 0.0 to Constants.JULIAN_DAY
(excluded). The two parameters
are used for increased accuracy.
secondInDayA
- first part of the second numbersecondInDayB
- last part of the second numberIllegalArgumentException
- if seconds number is out of rangepublic static TimeComponents parseTime(String string)
The supported formats are:
As this class does not support time zones (because space flight dynamics uses time scales
with offsets from UTC having sub-second accuracy), only UTC is zone is
supported (and in fact ignored). It is the responsibility of the AbsoluteDate
class to
handle time scales appropriately.
string
- string to parseIllegalArgumentException
- if string cannot be parsedpublic int getHour()
public int getMinute()
public double getSecond()
public double getSecondsInDay()
public String toString()
public int compareTo(TimeComponents other)
compareTo
in interface Comparable<TimeComponents>
Copyright © 2002-2015 CS Systèmes d'information. All rights reserved.