Basic implementation of Time interface, representing an abstract time of day such as 10am or 3.20pm with a precision of milliseconds.

no subtypes hierarchy

Initializer
TimeOfDay(Integer millisecondsOfDay)
Parameters:
  • millisecondsOfDay

    Number of milliseconds since last midnight.

Attributes
hoursSource Codeshared actual Integer hours

Number of full hours elapsed since last midnight.

millisecondsSource Codeshared actual Integer milliseconds

Number of milliseconds since last full second.

millisecondsOfDaySource Codeshared actual Integer millisecondsOfDay

Number of milliseconds since last midnight.

minutesSource Codeshared actual Integer minutes

Number of minutes since last full hour.

minutesOfDaySource Codeshared actual Integer minutesOfDay

Number of minutes since last midnight.

predecessorSource Codeshared actual Time predecessor

For predecessor its used the lowest unit of time, this way we can benefit from maximum precision. In this case the predecessor is the current value minus 1 millisecond.

Refines Enumerable.predecessor ultimately refines Ordinal.predecessor
secondsSource Codeshared actual Integer seconds

Number of seconds since last minute.

secondsOfDaySource Codeshared actual Integer secondsOfDay

Number of seconds since last midnight.

stringSource Codeshared actual String string

Returns ISO-8601 formatted String representation of this time of day.

Reference: https://en.wikipedia.org/wiki/ISO_8601#Times

successorSource Codeshared actual Time successor

For successor its used the lowest unit of time, this way we can benefit from maximum precision. In this case the successor is the current value plus 1 millisecond.

Refines Enumerable.successor ultimately refines Ordinal.successor
Inherited Attributes
Attributes inherited from: Object
Attributes inherited from: Enumerable<Other>
Attributes inherited from: Ordinal<Other>
Attributes inherited from: ReadableTime
Attributes inherited from: Time
Methods
compareSource Codeshared actual Comparison compare(Time other)

Compare two instances of time of day.

minusSource Codeshared actual Time minus(ReadableTimePeriod period)

Subtracts specified time period from this time of day and returns the result as new time of day.

Refines Time.minus
minusHoursSource Codeshared actual Time minusHours(Integer hours)

Subtracts specified number of hours from this time of day and returns the result as new time of day.

minusMillisecondsSource Codeshared actual Time minusMilliseconds(Integer milliseconds)

Subtracts specified number of milliseconds from this time of day and returns the result as new time of day.

minusMinutesSource Codeshared actual Time minusMinutes(Integer minutes)

Subtracts specified number of minutes from this time of day and returns the result as new time of day.

minusSecondsSource Codeshared actual Time minusSeconds(Integer seconds)

Subtracts specified number of seconds from this time of day and returns the result as new time of day.

neighbourSource Codeshared actual Time neighbour(Integer offset)

The indirect successor or predecessor at the given offset, where:

  • x.neighbour(0) == x,
  • x.neighbour(i+1) == x.neighbour(i).successor, and
  • x.neighbour(i-1) == x.neighbour(i).predecessor.
offsetSource Codeshared actual Integer offset(Time other)

Compute the offset from the given value, where:

  • x.offset(x) == 0, and
  • x.successor.offset(x) == 1 if x!=x.successor.
periodFromSource Codeshared actual Period periodFrom(Time start)

Returns the period between this and the given time.

If this time is before the given time then return zero period.

periodToSource Codeshared actual Period periodTo(Time end)

Returns the period between this and the given time.

If this time is after the given time then return zero period.

plusSource Codeshared actual Time plus(ReadableTimePeriod period)

Adds specified time period to this time of day and returns the result as new time of day.

Refines Time.plus
plusHoursSource Codeshared actual Time plusHours(Integer hours)

Adds specified number of hours to this time of day and returns the result as new time of day.

plusMillisecondsSource Codeshared actual Time plusMilliseconds(Integer milliseconds)

Adds specified number of milliseconds to this time of day and returns the result as new time of day.

plusMinutesSource Codeshared actual Time plusMinutes(Integer minutes)

Adds specified number of minutes to this time of day and returns the result as new time of day.

plusSecondsSource Codeshared actual Time plusSeconds(Integer seconds)

Adds specified number of seconds to this time of day and returns the result as new time of day.

rangeToSource Codeshared actual TimeRange rangeTo(Time other)

Returns the TimeRange between this and given Time.

Refines Time.rangeTo
withHoursSource Codeshared actual Time withHours(Integer hours)

Returns a copy of this Time replacing the hours value.

Note: It should be a valid hour.

withMillisecondsSource Codeshared actual Time withMilliseconds(Integer milliseconds)

Returns a copy of this Time replacing the milliseconds value.

Note: It should be a valid millisecond.

withMinutesSource Codeshared actual Time withMinutes(Integer minutes)

Returns a copy of this Time replacing the minutes value.

Note: It should be a valid minute.

withSecondsSource Codeshared actual Time withSeconds(Integer seconds)

Returns a copy of this Time replacing the seconds value.

Note: It should be a valid second.

Inherited Methods
Methods inherited from: Object
Methods inherited from: Comparable<Other>
Methods inherited from: Enumerable<Other>
Methods inherited from: Time
Methods inherited from: TimeBehavior<Element>