Package org.apache.flink.api.common.time
Class Time
- java.lang.Object
-
- org.apache.flink.api.common.time.Time
-
- All Implemented Interfaces:
Serializable
@PublicEvolving public final class Time extends Object implements Serializable
The definition of a time interval. Similar to a simpler version ofDuration.Note: This class will fully replace org.apache.flink.streaming.api.windowing.time.Time in Flink 2.0
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Timedays(long days)Creates a newTimethat represents the given number of days.booleanequals(Object o)static TimefromDuration(java.time.Duration duration)Creates a newTimethat represents the number of milliseconds in the given duration.longgetSize()Gets the length of this policy's time interval.TimeUnitgetUnit()Gets the time unit for this policy's time interval.inthashCode()static Timehours(long hours)Creates a newTimethat represents the given number of hours.static Timemilliseconds(long milliseconds)Creates a newTimethat represents the given number of milliseconds.static Timeminutes(long minutes)Creates a newTimethat represents the given number of minutes.static Timeof(long size, TimeUnit unit)static Timeseconds(long seconds)Creates a newTimethat represents the given number of seconds.longtoMilliseconds()Converts the time interval to milliseconds.StringtoString()
-
-
-
Method Detail
-
getUnit
public TimeUnit getUnit()
Gets the time unit for this policy's time interval.- Returns:
- The time unit for this policy's time interval.
-
getSize
public long getSize()
Gets the length of this policy's time interval.- Returns:
- The length of this policy's time interval.
-
toMilliseconds
public long toMilliseconds()
Converts the time interval to milliseconds.- Returns:
- The time interval in milliseconds.
-
of
public static Time of(long size, TimeUnit unit)
- Parameters:
size- The duration of time.unit- The unit of time of the duration, for exampleTimeUnit.SECONDS.- Returns:
- The time policy.
-
milliseconds
public static Time milliseconds(long milliseconds)
Creates a newTimethat represents the given number of milliseconds.
-
seconds
public static Time seconds(long seconds)
Creates a newTimethat represents the given number of seconds.
-
minutes
public static Time minutes(long minutes)
Creates a newTimethat represents the given number of minutes.
-
hours
public static Time hours(long hours)
Creates a newTimethat represents the given number of hours.
-
days
public static Time days(long days)
Creates a newTimethat represents the given number of days.
-
-