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.
|
TimeComponents(int hour,
int minute,
double second,
int minutesFromUTC)
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.
|
int |
getMinutesFromUTC()
Get the offset between the specified date and UTC.
|
double |
getSecond()
Get the seconds number.
|
double |
getSecondsInLocalDay()
Get the second number within the local day, without applying the
offset from UTC . |
double |
getSecondsInUTCDay()
Get the second number within the UTC day, applying the
offset from UTC . |
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(int hour, int minute, double second, int minutesFromUTC) 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)minutesFromUTC
- offset between the specified date and UTC, as an
integral number of minutes, as per ISO-8601 standardIllegalArgumentException
- if inconsistent arguments
are given (parameters out of range)public TimeComponents(double secondInDay) throws OrekitIllegalArgumentException
This constructor is always in UTC (i.e. will return 0
).
secondInDay
- second number from 0.0 to Constants.JULIAN_DAY
(excluded)OrekitIllegalArgumentException
- if seconds number is out of rangepublic TimeComponents(int secondInDayA, double secondInDayB) throws OrekitIllegalArgumentException
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.
This constructor is always in UTC (i.e. will return 0
).
secondInDayA
- first part of the second numbersecondInDayB
- last part of the second numberOrekitIllegalArgumentException
- if seconds number is out of rangepublic static TimeComponents parseTime(String string)
The supported formats are:
As shown by the list above, only the complete representations defined in section 4.2 of ISO-8601 standard are supported, neither expended representations nor representations with reduced accuracy are supported.
string
- string to parseIllegalArgumentException
- if string cannot be parsedpublic int getHour()
public int getMinute()
public double getSecond()
public int getMinutesFromUTC()
The offset is always an integral number of minutes, as per ISO-8601 standard.
public double getSecondsInLocalDay()
offset from UTC
.getSecondsInUTCDay()
public double getSecondsInUTCDay()
offset from UTC
.-getMinutesFromUTC()
to Constants.JULIAN_DAY + getMinutesFromUTC()
getSecondsInLocalDay()
public String toString()
public int compareTo(TimeComponents other)
compareTo
in interface Comparable<TimeComponents>
Copyright © 2002-2017 CS Systèmes d'information. All rights reserved.