Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace SpaceTimeController

Index

Functions

get_jNow

  • get_jNow(): number
  • Get the current time as a Julian date in the UTC timescale (which is problematic)

    Julian dates measure time as a continuous number of days since a reference point far in the past. Dates around the present will be numbers larger than 2.4 million.

    Note that it is not rigorously correct to express UTC times as Julian dates, because it is not well-defined how to handle leap seconds. As such, the accuracy of time-dependent computations in WWT should only be trusted to granularities of about a minute.

    Returns number

get_now

  • get_now(): Date

get_syncToClock

  • get_syncToClock(): boolean
  • Get whether the WWT clock moves at the same rate as the system clock.

    Note that this value may be true but there may still be a constant offset between the two clocks.

    Returns boolean

get_timeRate

  • get_timeRate(): number
  • Get the rate at which the WWT clock advances relative to the system time.

    A value of 1 means that the two clocks stay in sync. A value of 10 means that time in WWT proceeds 10 times faster than system time. The rate may be negative.

    Returns number

julianToUtc

  • julianToUtc(jdate: number): Date
  • Convert a Julian date to a JavaScript UTC datetime.

    Parameters

    • jdate: number

      The Julian date, usually a number around 2.4 million.

    Returns Date

    A Javascript datetime.

    See get_jNow for commentary on this conversion, which is not rigorously correct and can only be trusted to granularities of less than around a minute.

set_now

  • set_now(date: Date): Date
  • Set the current time as a JavaScript Date in the UTC timescale.

    Parameters

    • date: Date

      The date.

    Returns Date

    The date that was just set.

set_syncToClock

  • set_syncToClock(sync: boolean): boolean
  • Set whether the WWT clock moves at the same rate as the system clock.

    Parameters

    • sync: boolean

      Whether the clock rates are to be synchronized.

    Returns boolean

    The input argument.

    If set to false, the WWT clock will stop advancing, ignoring the value of get_timeRate. If set to true, the WWT clock will resume advancing from where it left off, possibly inducing an offset between the WWT clock and the system clock.

set_timeRate

  • set_timeRate(rate: number): number
  • Set the rate at which the WWT clock advances relative to the system time.

    Parameters

    • rate: number

      The rate factor.

    Returns number

    The input argument.

    A value of 1 means that the two clocks stay in sync. A value of 10 means that time in WWT proceeds 10 times faster than system time. The rate may be negative.

    Do not set the rate to zero. Instead, call set_syncToClock with a false argument.

syncTime

  • syncTime(): void
  • Have the WWT clock immediately lock onto to the system clock.

    This function not only has the effect of calling set_syncToClock with a true argument, it also sets the offset between the two clocks to be zero.

    Returns void

utcToJulian

  • utcToJulian(date: Date): number
  • Convert a JavaScript UTC datetime to a Julian date.

    Parameters

    • date: Date

      The datetime.

    Returns number

    A Julian date.

    See get_jNow for commentary on this conversion, which is not rigorously correct and can only be trusted to granularities of less than around a minute.

Generated using TypeDoc