Class UTCTime

All Implemented Interfaces:
Serializable, Comparable<Time>, OsidPrimitive, Time, Time, OsidPrimitive

public final class UTCTime extends Abstract246060Time implements Time
An implementation of a Time based on UTC using a UTCTimeDefinition. Currently, leap seconds are not supported in this class.
See Also:
  • Constructor Details

    • UTCTime

      public UTCTime(long hour, long minute, long second)
      Constructs a new UTCTime with second resolution.
      Parameters:
      hour - the hour
      minute - the minute
      second - the second
      Throws:
      InvalidArgumentException - hour, minute, or second is negative, or hour is greater than 23 minute is greater than 59, or second is greater than 60
    • UTCTime

      public UTCTime(UTCTime.UTCTimeSpecifier specifier)
      Constructs a new UTCTime.
      Parameters:
      specifier - a time specifier
      Throws:
      NullArgumentException - specifier is null
  • Method Details

    • valueOf

      public static Time valueOf(String s)
      Returns a Time for a time format.
      Parameters:
      s - the s
      Returns:
      a string
      Throws:
      InvalidArgumentException - cannot parse string
      NullArgumentException - s is null
    • time

      public static Time time(String s)
      Returns a Time parsed from a time string. An alias for valueOf(String).
      Parameters:
      s - the time string
      Returns:
      the parsed Time
      Throws:
      InvalidArgumentException - cannot parse string
      NullArgumentException - s is null
    • valueOf

      public static Time valueOf(long hour)
      Creates a time at hour resolution.
      Parameters:
      hour - the hour
      Returns:
      a Time
      Throws:
      InvalidArgumentException - hour is out of range
    • valueOf

      public static Time valueOf(long hour, long minute)
      Creates a time at minute resolution.
      Parameters:
      hour - the hour
      minute - the minute
      Returns:
      a Time
      Throws:
      InvalidArgumentException - a component is out of range
    • valueOf

      public static Time valueOf(long hour, long minute, long second)
      Creates a time at second resolution.
      Parameters:
      hour - the hour
      minute - the minute
      second - the second
      Returns:
      a Time
      Throws:
      InvalidArgumentException - a component is out of range
    • valueOf

      public static Time valueOf(LocalTime time)
      Creates a time from a Java LocalTime. The resolution follows the value's actual precision: second when it has no fraction, else millisecond, microsecond, or nanosecond by the finest non-zero part.
      Parameters:
      time - a Java time LocalTime
      Returns:
      a Time
      Throws:
      NullArgumentException - time is null
    • time

      public static Time time(long hour)
      Creates a time at hour resolution. Equivalent to valueOf(long).
      Parameters:
      hour - the hour
      Returns:
      a Time
    • time

      public static Time time(long hour, long minute)
      Creates a time at minute resolution. Equivalent to valueOf(long, long).
      Parameters:
      hour - the hour
      minute - the minute
      Returns:
      a Time
    • time

      public static Time time(long hour, long minute, long second)
      Creates a time at second resolution. Equivalent to valueOf(long, long, long).
      Parameters:
      hour - the hour
      minute - the minute
      second - the second
      Returns:
      a Time
    • time

      public static Time time(LocalTime localTime)
      Creates a time from a Java LocalTime. Equivalent to valueOf(java.time.LocalTime).
      Parameters:
      localTime - a Java time LocalTime
      Returns:
      a Time
      Throws:
      NullArgumentException - localTime is null
    • valueOf

      public static Time valueOf(long hour, long minute, long second, BigDecimal fractionalSecond)
      Creates a time with a fractional second. The resolution follows the number of fractional digits: each group of three is a finer unit (millisecond, microsecond, ...) and a partial final group carries a multiplier (one digit means hundreds, two means tens). A fraction finer than a microquectosecond (more than 36 digits) is truncated to planck seconds, the smallest representable unit.
      Parameters:
      hour - the hour
      minute - the minute
      second - the second
      fractionalSecond - the fraction of a second, in [0, 1)
      Returns:
      a Time
      Throws:
      InvalidArgumentException - fractionalSecond is not in [0, 1), or a component is out of range
      NullArgumentException - fractionalSecond is null
    • time

      public static Time time(long hour, long minute, long second, BigDecimal fractionalSecond)
      Creates a time with a fractional second. Equivalent to valueOf(long, long, long, BigDecimal).
      Parameters:
      hour - the hour
      minute - the minute
      second - the second
      fractionalSecond - the fraction of a second, in [0, 1)
      Returns:
      a Time
      Throws:
      InvalidArgumentException - fractionalSecond is not in [0, 1), or a component is out of range
      NullArgumentException - fractionalSecond is null
    • unknown

      public static Time unknown()
      Gets an unknown date.
      Returns:
      an unknown date