AbsoluteTime

org.abh80.nf.core.time.AbsoluteTime
See theAbsoluteTime companion object
class AbsoluteTime(tf: TimeFormat) extends TimeFormat, Comparable[TimeFormat], Serializable

Represents an absolute point in time based on a given time format and timescale.

Internally, time is represented as a TimeFormat (seconds + attoseconds) relative to the J2000 epoch (January 1, 2000, 12:00 TT).

==Mathematical Background==

  • The J2000 epoch is defined as JD 2451545.0 TT (Julian Date).
  • Conversion between calendar date and J2000 offset is done by:
 seconds = (days_since_J2000 * 86400) + time_of_day_seconds
  • Leap seconds and timescale offsets (e.g., UTC → TAI → TT) are applied using TimeScale transformations.

Value parameters

tf

the underlying time format instance used to represent the absolute time

Attributes

See also

TimeFormat

TimeScale

Companion
object
Graph
Supertypes
class TimeFormat
trait Serializable
trait Comparable[TimeFormat]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Constructors

def this()

Default constructor. Creates an AbsoluteTime instance using the J2000 epoch (January 1, 2000, 12:00 TT).

Default constructor. Creates an AbsoluteTime instance using the J2000 epoch (January 1, 2000, 12:00 TT).

==Math Note==

  • J2000 epoch corresponds to JD 2451545.0 TT.
  • This is exactly 12:00 Terrestrial Time on Jan 1, 2000.

Attributes

def this(date: Date, time: Time, scale: TimeScale)

Constructor to create an AbsoluteTime instance using a Date, Time, and TimeScale.

Constructor to create an AbsoluteTime instance using a Date, Time, and TimeScale.

==Math Note==

  • Days since J2000 are converted to seconds:
 total_seconds = (days_since_J2000 * 86400)
               + (hours * 3600)
               + (minutes * 60)
               + seconds

Value parameters

date

the date component

scale

the time scale used to convert the time to TAI

time

the time component

Attributes

def this(year: Int, month: Int, day: Int, hour: Int, minute: Int, seconds: TimeFormat, scale: TimeScale)

Constructor to create an AbsoluteTime instance using year, month, day, hour, minute, seconds (as TimeFormat), and a TimeScale.

Constructor to create an AbsoluteTime instance using year, month, day, hour, minute, seconds (as TimeFormat), and a TimeScale.

==Math Note==

  • Calendar date → Julian Day Number (JDN) → J2000 offset.
  • J2000 offset = (JDN - 2451545.0) * 86400.

Attributes

Throws
IllegalArgumentException

if the input values are invalid

def this(year: Int, month: Int, day: Int, hour: Int, minute: Int, seconds: Double, scale: TimeScale)

Constructor to create an AbsoluteTime instance using year, month, day, hour, minute, seconds (as Double), and a TimeScale.

Constructor to create an AbsoluteTime instance using year, month, day, hour, minute, seconds (as Double), and a TimeScale.

==Math Note==

  • Seconds are converted to TimeFormat with attosecond precision.

Attributes

Throws
IllegalArgumentException

if the input values are invalid

def this(year: Int, month: Month, day: Int, hour: Int, minute: Int, seconds: TimeFormat, scale: TimeScale)

Constructor to create an AbsoluteTime instance using year, month (as Month enum), day, hour, minute, seconds (as TimeFormat), and a TimeScale.

Constructor to create an AbsoluteTime instance using year, month (as Month enum), day, hour, minute, seconds (as TimeFormat), and a TimeScale.

==Math Note==

  • Uses Month.getIntegerValue to map enum → integer month.

Attributes

def this(year: Int, month: Month, day: Int, hour: Int, minute: Int, seconds: Double, scale: TimeScale)

Constructor to create an AbsoluteTime instance using year, month (as Month enum), day, hour, minute, seconds (as Double), and a TimeScale.

Constructor to create an AbsoluteTime instance using year, month (as Month enum), day, hour, minute, seconds (as Double), and a TimeScale.

Attributes

def this(date: Date, scale: TimeScale)

Constructor to create an AbsoluteTime instance using a Date and a TimeScale. The time component is set to 00:00:00 by default.

Constructor to create an AbsoluteTime instance using a Date and a TimeScale. The time component is set to 00:00:00 by default.

Attributes

def this(year: Int, month: Int, day: Int, scale: TimeScale)

Constructor to create an AbsoluteTime instance using year, month, day, and a TimeScale. The time component is set to 00:00:00 by default.

Constructor to create an AbsoluteTime instance using year, month, day, and a TimeScale. The time component is set to 00:00:00 by default.

Attributes

def this(instant: Instant, scale: TimeScale)

Constructor to create an AbsoluteTime instance from a Java Instant and a given timescale.

Constructor to create an AbsoluteTime instance from a Java Instant and a given timescale.

==Math Note==

  • Java Instant is always UTC-based.
  • Conversion: epoch_seconds + nanos → TimeFormat.

Attributes

def this(instant: Instant)

Constructor to create an AbsoluteTime instance from a Java Instant. Uses UTC as the default timescale.

Constructor to create an AbsoluteTime instance from a Java Instant. Uses UTC as the default timescale.

Attributes

Concrete methods

def ++(other: TimeFormat): AbsoluteTime
Implicitly added by BinOp

Shift by a TimeFormat duration.

Shift by a TimeFormat duration.

Attributes

def ++(shiftBy: Long): AbsoluteTime
Implicitly added by BinOp

Shift by a number of seconds (Long).

Shift by a number of seconds (Long).

Attributes

def ++(shiftBy: Double): AbsoluteTime
Implicitly added by BinOp

Shift by a number of seconds (Double).

Shift by a number of seconds (Double).

Attributes

Computes the duration between this time and another AbsoluteTime.

Computes the duration between this time and another AbsoluteTime.

==Math Note==

  • Duration = Δt = (this.seconds - other.seconds).

Attributes

def getDateTime(scale: TimeScale): (Date, Time)

Converts this absolute time into a (Date, Time) pair in the given timescale.

Converts this absolute time into a (Date, Time) pair in the given timescale.

==Math Note==

  • Shift by 43200 seconds (12h) because J2000 epoch is defined at 12:00 TT, not midnight.
  • Day calculation:
 j2000_shifted = seconds_since_J2000 + 43200
 day_index     = floor(j2000_shifted / 86400)
 time_of_day   = j2000_shifted mod 86400
  • Leap seconds are applied if the instant falls inside a leap second.

Value parameters

scale

the timescale to use

Attributes

Returns

a tuple of (Date, Time)

def offsetBetween(scale1: TimeScale, scale2: TimeScale): TimeFormat

Computes the offset between two time scales at this absolute time.

Computes the offset between two time scales at this absolute time.

==Math Note==

  • Offset = Δ = (scale1 - TAI) - (scale2 - TAI).
  • Example: UTC vs TAI → difference = leap seconds.

Value parameters

scale1

the first timescale

scale2

the second timescale

Attributes

Returns

the offset between the two timescales as a TimeFormat

override def toString: String

Returns the ISO-8601 string representation of this time in UTC. Appends "Z" to indicate UTC.

Returns the ISO-8601 string representation of this time in UTC. Appends "Z" to indicate UTC.

Attributes

Definition Classes
TimeFormat -> Any
def toString(scale: TimeScale): String

Returns the ISO-8601 string representation of this time in the given timescale.

Returns the ISO-8601 string representation of this time in the given timescale.

==Math Note==

  • Format: YYYY-MM-DDTHH:MM:SS[.fraction]

Attributes

Inherited methods

override def compareTo(o: TimeFormat): Int

Compares this TimeFormat instance with another TimeFormat instance.

Compares this TimeFormat instance with another TimeFormat instance.

Value parameters

o

The TimeFormat instance to compare with

Attributes

Returns

An integer value: - Negative if this instance is less than the other - Zero if they are equal - Positive if this instance is greater than the other

Definition Classes
TimeFormat -> Comparable
Inherited from:
TimeFormat
override def equals(obj: Any): Boolean

Compares the receiver object (this) with the argument object (that) for equivalence.

Compares the receiver object (this) with the argument object (that) for equivalence.

Any implementation of this method should be an equivalence relation:

  • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
  • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any instances x, y, and z of type Any if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override hashCode to ensure that objects which are "equal" (o1.equals(o2) returns true) hash to the same scala.Int. (o1.hashCode.equals(o2.hashCode)).

Value parameters

that

the object to compare against this object for equality.

Attributes

Returns

true if the receiver object is equivalent to the argument; false otherwise.

Definition Classes
TimeFormat -> Any
Inherited from:
TimeFormat
def getAttoSeconds: Long

Gets the attoseconds component of the time value.

Gets the attoseconds component of the time value.

Attributes

Returns

The number of attoseconds

Inherited from:
TimeFormat
def getRoundedFormat(precision: Int): TimeFormat

Attributes

Inherited from:
TimeFormat
def getSeconds: Long

Gets the seconds component of the time value.

Gets the seconds component of the time value.

Attributes

Returns

The number of seconds

Inherited from:
TimeFormat
override def hashCode(): Int

Calculates a hash code value for the object.

Calculates a hash code value for the object.

The default hashing algorithm is platform dependent.

Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

Attributes

Returns

the hash code value for this object.

Definition Classes
TimeFormat -> Any
Inherited from:
TimeFormat
def isZero: Boolean

Checks if this TimeFormat represents zero time (both seconds and attoseconds are 0).

Checks if this TimeFormat represents zero time (both seconds and attoseconds are 0).

Attributes

Returns

true if the time value is zero, false otherwise

Inherited from:
TimeFormat

Creates a new TimeFormat instance with the negated values of seconds and attoseconds.

Creates a new TimeFormat instance with the negated values of seconds and attoseconds.

Attributes

Returns

A new TimeFormat instance with negated values

Inherited from:
TimeFormat
def toDouble: Double

Converts current time format to double, "seconds[.]attoseconds"

Converts current time format to double, "seconds[.]attoseconds"

Attributes

Returns

a double value

Inherited from:
TimeFormat