Package com.kosherjava.zmanim.util
Class Time
java.lang.Object
com.kosherjava.zmanim.util.Time
A class that represents a numeric time. Times that represent a time of day are stored as
Date
s in
this API. The time class is used to represent numeric time such as the time in hours, minutes, seconds and
milliseconds of a temporal hour
.- Author:
- © Eliyahu Hershfeld 2004 - 2020
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
milliseconds in an hour.private int
private boolean
private int
private static final int
milliseconds in a minute.private int
private static final int
milliseconds in a second.private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
getHours()
int
int
int
double
getTime()
Returns the time in milliseconds by converting hours, minutes and seconds into milliseconds.boolean
Does the time represent a negative time 9such as using this to subtract time from another Time.void
setHours
(int hours) void
setIsNegative
(boolean isNegative) Set this to represent a negative time.void
setMilliseconds
(int milliseconds) void
setMinutes
(int minutes) void
setSeconds
(int seconds) toString()
-
Field Details
-
SECOND_MILLIS
milliseconds in a second.- See Also:
-
MINUTE_MILLIS
milliseconds in a minute.- See Also:
-
HOUR_MILLIS
milliseconds in an hour.- See Also:
-
hours
- See Also:
-
minutes
- See Also:
-
seconds
- See Also:
-
milliseconds
- See Also:
-
isNegative
- See Also:
-
-
Constructor Details
-
Time
Constructor with parameters for the hours, minutes, seconds and millisecods.- Parameters:
hours
- the hours to setminutes
- the minutes to setseconds
- the seconds to setmilliseconds
- the milliseconds to set
-
Time
Constructor with a parameter for milliseconds. This constructor casts the milliseconds to an int and callsTime(int)
- Parameters:
millis
- the milliseconds to set the object with.
-
Time
A constructor that sets the time by milliseconds. The milliseconds are converted to hours, minutes, seconds and milliseconds. If the milliseconds are negative it will callsetIsNegative(boolean)
.- Parameters:
millis
- the milliseconds to set.
-
-
Method Details
-
isNegative
Does the time represent a negative time 9such as using this to subtract time from another Time.- Returns:
- if the time is negative.
-
setIsNegative
Set this to represent a negative time.- Parameters:
isNegative
- that the Time represents negative time
-
getHours
- Returns:
- Returns the hour.
-
setHours
- Parameters:
hours
- The hours to set.
-
getMinutes
- Returns:
- Returns the minutes.
-
setMinutes
- Parameters:
minutes
- The minutes to set.
-
getSeconds
- Returns:
- Returns the seconds.
-
setSeconds
- Parameters:
seconds
- The seconds to set.
-
getMilliseconds
- Returns:
- Returns the milliseconds.
-
setMilliseconds
- Parameters:
milliseconds
- The milliseconds to set.
-
getTime
Returns the time in milliseconds by converting hours, minutes and seconds into milliseconds.- Returns:
- the time in milliseconds
-
toString
-