Time

org.abh80.nf.core.time.Time
See theTime companion object
class Time extends Comparable[Time], Serializable

A robust time implementation with Hour, Minutes, Seconds of a day. Seconds are in precision up to attoseconds.

Attributes

See also

TimeFormat

Date

Note

This class is immutable and thread-safe

Companion
object
Graph
Supertypes
trait Serializable
trait Comparable[Time]
class Object
trait Matchable
class Any

Members list

Value members

Constructors

def this(hour: Int, minute: Int, seconds: TimeFormat, utcOffset: Int)

Build a time object from clock elements.

Build a time object from clock elements.

Value parameters

hour

the hour of the day

minute

the minute of the hour

seconds

the second of the minute

utcOffset

the offset from utc represented in minutes, in +ve or -ve

Attributes

Throws
IllegalArgumentException

when invalid time components are provided, example: 24 hours

def this(hour: Int, minute: Int, seconds: Double, utcOffset: Int)

Build a time object from clock elements.

Build a time object from clock elements.

Value parameters

hour

the hour of the day

minute

the minute of the hour

seconds

the second of the minute

utcOffset

the offset from utc represented in minutes, in +ve or -ve

Attributes

Throws
IllegalArgumentException

when invalid time components are provided, example: 24 hours

def this(hour: Int, minute: Int, seconds: TimeFormat)

Build a time object from clock elements.

Build a time object from clock elements.

Value parameters

hour

the hour of the day

minute

the minute of the hour

seconds

the second of the minute

Attributes

Throws
IllegalArgumentException

when invalid time components are provided, example: 24 hours

def this(hour: Int, minute: Int, seconds: Double)

Build a time object from clock elements.

Build a time object from clock elements.

Value parameters

hour

the hour of the day

minute

the minute of the hour

seconds

the second of the minute

Attributes

Throws
IllegalArgumentException

when invalid time components are provided, example: 24 hours

def this(instant: Instant)

Build a time object from an Instant.

Build a time object from an Instant.

Value parameters

instant

the Instant to convert to a Time object

Attributes

Throws
IllegalArgumentException

if the conversion fails This constructor assumes the UTC time zone and extracts the hour, minute, and second components from the provided Instant. The UTC offset is set to 0.

def this(seconds: TimeFormat)

Build a time object from seconds in a day.

Build a time object from seconds in a day.

Value parameters

seconds

the seconds parsed in TimeFormat

Attributes

Throws
IllegalArgumentException

when TimeFormat cannot parse the seconds

See also

TimeFormat

#Time(Double)

def this(seconds: Double)

Build a Time object from seconds of a local day.

Build a Time object from seconds of a local day.

Value parameters

seconds

the seconds in double

Attributes

Throws
IllegalArgumentException

when TimeFormat cannot parse the seconds

See also

TimeFormat#fromDouble

def this(seconds: TimeFormat, leap: TimeFormat, minuteDuration: Int)

Concrete methods

override def compareTo(o: Time): Int

Compare with another Time Object

Compare with another Time Object

Attributes

Definition Classes
Comparable
override def equals(obj: Any): Boolean

Check equality

Check equality

Attributes

Definition Classes
Any
def getHour: Int

Get the hour of the day

Get the hour of the day

Attributes

def getMinute: Int

Get the minute of the hour

Get the minute of the hour

Attributes

def getSeconds: Double

Get the seconds of the minute

Get the seconds of the minute

Attributes

Get the seconds of the minute as time format

Get the seconds of the minute as time format

Attributes

def getSecondsInDay: Double

Get the seconds of the day

Get the seconds of the day

Attributes

def getSecondsInDayObject(offset: Int): TimeFormat

Returns the seconds in a day as TimeFormat

Returns the seconds in a day as TimeFormat

Attributes

def getSecondsInUTCDay: Double

Get the seconds of the day but adjusted with utc offset

Get the seconds of the day but adjusted with utc offset

Attributes

def getUTCOffsetString: String

Get the current UTC offset in ISO8601 standard

Get the current UTC offset in ISO8601 standard

Attributes

def getUtcOffset: Int

Get the utc offset in minutes

Get the utc offset in minutes

Attributes

override def hashCode(): Int

Hashcode

Hashcode

Attributes

Definition Classes
Any
def toISO8601String(secondsPrecision: Int): String

Get the current time formatted in IS08601; no UTC offset is added

Get the current time formatted in IS08601; no UTC offset is added

Attributes

def toISO8601StringTrimmed(secondsPrecision: Int): String
override def toString: String

Get the current time formatted in IS08601 UTC

Get the current time formatted in IS08601 UTC

Attributes

Definition Classes
Any