org.abh80.nf.core.time

Members list

Type members

Classlikes

class AbsoluteTime(tf: TimeFormat) extends TimeFormat, Comparable[TimeFormat], Serializable

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

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
Supertypes
class TimeFormat
trait Serializable
trait Comparable[TimeFormat]
class Object
trait Matchable
class Any
Show all
object AbsoluteTime

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class Date extends Comparable[Date], Serializable

A robust date implementation that handles dates in different calendar systems.

A robust date implementation that handles dates in different calendar systems.

This class provides functionality to work with dates across three calendar systems:

  • Gregorian calendar (current standard calendar system)
  • Julian calendar (historical calendar used before Gregorian)
  • Proleptic Julian calendar (extension of Julian calendar for dates before year 1)

The implementation uses J2000 day number as internal representation, which counts days from January 1, 2000 (known as the J2000 epoch in astronomy).

The class automatically handles calendar transitions:

  • Before year 1: Proleptic Julian calendar
  • Years 1-1582: Julian calendar
  • After October 4, 1582: Gregorian calendar

Attributes

Note

This class is immutable and thread-safe

it's recommended to initialize this class from the Date companion object

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

Factory methods for creating Date instances.

Factory methods for creating Date instances.

This companion object provides various apply methods to construct Date objects using different date components and epoch references. These methods offer flexibility in creating Date instances from J2000 offsets, year/month/day combinations, or year/day-of-year combinations.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Date.type
object EpochFactory

Factory object providing commonly used epoch reference dates in astronomy and time systems.

Factory object providing commonly used epoch reference dates in astronomy and time systems.

This object contains predefined epoch dates that are frequently used in astronomical calculations and various time reference systems. These epochs serve as reference points for different time scales and coordinate systems.

Attributes

See also
Supertypes
class Object
trait Matchable
class Any
Self type
class FixedTimeOffsetScale(val name: String, val offset: TimeFormat) extends TimeScale

A time scale that applies a fixed offset to TAI.

A time scale that applies a fixed offset to TAI.

Value parameters

name

The name of this time scale.

offset

The fixed offset to apply to TAI. This offset represents the difference between the target time scale and TAI. For example, if the target time scale is always 10 seconds ahead of TAI, then the offset should be +10 seconds.

Attributes

Supertypes
trait TimeScale
class Object
trait Matchable
class Any
Known subtypes
class GPSScale
class IRNSSScale
class TAIScale
class TTScale
class TDTScale
class GLONASSScale(utc: TimeScale) extends TimeScale

GLONASS scale implementation GLONASS is a fixed offset from UTC + 3 hours

GLONASS scale implementation GLONASS is a fixed offset from UTC + 3 hours

Value parameters

utc

UTC scale

Attributes

Supertypes
trait TimeScale
class Object
trait Matchable
class Any

GPS scale implementation

GPS scale implementation

Attributes

See also
Supertypes
trait TimeScale
class Object
trait Matchable
class Any

NavIC timescale (also called IRNWT for IRNSS NetWork Time).

NavIC timescale (also called IRNWT for IRNSS NetWork Time).

Attributes

See also
Supertypes
trait TimeScale
class Object
trait Matchable
class Any

TAI scale implementation

TAI scale implementation

Attributes

See also
Supertypes
trait TimeScale
class Object
trait Matchable
class Any
class TDBScale(val tt: TimeScale, j2000Epoch: AbsoluteTime) extends TimeScale

Value parameters

j2000Epoch

The j2000 standard epoch

tt

The Terrestrial Time Scale

Attributes

See also
Note

Do not instantiate this class for most cases. See TimeScaleFactory

Supertypes
trait TimeScale
class Object
trait Matchable
class Any
class TDTScale extends TTScale

TDT is the same as TTScale

TDT is the same as TTScale

Attributes

Supertypes
class TTScale
trait TimeScale
class Object
trait Matchable
class Any
Show all

TT scale implementation

TT scale implementation

Attributes

See also
Supertypes
trait TimeScale
class Object
trait Matchable
class Any
Known subtypes
class TDTScale
class Time extends Comparable[Time], Serializable

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

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
Supertypes
trait Serializable
trait Comparable[Time]
class Object
trait Matchable
class Any
object Time

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Time.type
class TimeFormat(var seconds: Long, var attoseconds: Long) extends Comparable[TimeFormat], Serializable

Represents a time format with second and attosecond precision.

Represents a time format with second and attosecond precision.

This class allows representing time values with a high degree of precision, using seconds and attoseconds (10^-18 seconds) as the units. It provides functionalities for basic arithmetic operations, comparisons, and conversions to and from other time units.

Value parameters

attoseconds

The number of attoseconds. Can be positive, negative, or zero. Must be in the range (-10^18, 10^18).

seconds

The number of seconds. Can be positive, negative, or zero.

Attributes

Throws
IllegalArgumentException

if attoseconds is outside the allowed range. Example usage:

 val time1 = new TimeFormat(1, 500000000000000000L) // 1.5 seconds
 val time2 = new TimeFormat(0, 750000000000000000L) // 0.75 seconds
 val sum = time1 + time2 // 2.25 seconds
 val difference = time1 - time2 // 0.75 seconds
 println(s"Sum: $sum")
 println(s"Difference: $difference")
Companion
object
Supertypes
trait Serializable
trait Comparable[TimeFormat]
class Object
trait Matchable
class Any
Known subtypes
class AbsoluteTime
object TimeFormat

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
TimeFormat.type
trait TimeScale

A trait representing a time scale system for astronomical time calculations.

A trait representing a time scale system for astronomical time calculations.

TimeScale provides mechanisms to convert between different time standards, with TAI (International Atomic Time) serving as a reference scale. Time scales may handle leap seconds and other time adjustments differently.

Common implementations include UTC, TAI, TT, etc.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class GPSScale
class IRNSSScale
class TAIScale
class TTScale
class TDTScale
class GLONASSScale
class TDBScale
class UTCScale
Show all

A factory for obtaining singleton instances of various time scales.

A factory for obtaining singleton instances of various time scales.

This object uses a thread-safe approach with AtomicReference to ensure that only a single instance of each time scale is created and returned. This is a form of the Singleton design pattern.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
enum TimeUnit

Represents different units of time measurement in descending order of magnitude.

Represents different units of time measurement in descending order of magnitude.

This enum provides various time units from days down to attoseconds, allowing for precise time measurements and conversions across different scales.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
class UTCScale(tai: TimeScale, leapOffsets: Array[LeapSecondOffset]) extends TimeScale

Implements the UTC (Coordinated Universal Time) time scale, including leap second handling.

Implements the UTC (Coordinated Universal Time) time scale, including leap second handling.

This class provides conversion between TAI (International Atomic Time) and UTC, accounting for historical and current leap second definitions. It maintains a list of leap second offsets and computes the appropriate offset for any given time.

Value parameters

leapOffsets

The leap offsets after Jan 1. 2017. Likely to be deprecated after 2035, since the leap seconds will be dropped by then.

tai

The TAI time scale instance used as a reference for conversions.

Attributes

See also
Example
                  val leapOffsets = Array(
                    LeapSecondOffset(Date(2024, 1, 1), 0, 38, 0),
                    LeapSecondOffset(Date(2025, 7, 1), 0, 39, 0)
                  )
                  val scale = UTCScale(TimeScaleFactory.getTAI, leapOffsets)
Companion
object
Supertypes
trait TimeScale
class Object
trait Matchable
class Any
object UTCScale

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
UTCScale.type