openspace.time

Functions overview

Name

Documentation

advancedTime

Modifies the passed time (first argument) by the delta time (second argument)

convertTime

Converts the given time to either a J2000 seconds number or a ISO 8601 timestamp, depending on the type of the given time

currentApplicationTime

Returns the current application time as the number of seconds since the OpenSpace application started

currentTime

Returns the current time as the number of seconds since the J2000 epoch

currentWallTime

Returns the current wall time as an ISO 8601 date string (YYYY-MM-DDTHH-MN-SS) in the UTC timezone

deltaTime

Returns the amount of simulated time that passes in one second of real time

interpolateDeltaTime

Sets the amount of simulation time that happens in one second of real time

interpolateNextDeltaTimeStep

Interpolate the simulation speed to the first delta time step in the list that is larger than the current simulation speed, if any

interpolatePause

Same behaviour as setPause, but with interpolation

interpolatePreviousDeltaTimeStep

Interpolate the simulation speed to the first delta time step in the list that is smaller than the current simulation speed, if any

interpolateTime

Sets the current simulation time to the specified value

interpolateTimeRelative

Increments the current simulation time by the specified number of seconds

interpolateTogglePause

Toggles the pause function, i

isPaused

Returns whether the simulation time is currently paused or is progressing

pauseToggleViaKeyboard

This allows for a keypress (via keybinding) to have dual functionality

setDeltaTime

Sets the amount of simulation time that happens in one second of real time

setDeltaTimeSteps

Sets the list of discrete delta time steps for the simulation speed that can be quickly jumped between

setNextDeltaTimeStep

Immediately set the simulation speed to the first delta time step in the list that is larger than the current choice of simulation speed, if any

setPause

Toggles a pause function i

setPreviousDeltaTimeStep

Immediately set the simulation speed to the first delta time step in the list that is smaller than the current choice of simulation speed if any

setTime

Sets the current simulation time to the specified value

SPICE

Returns the current time as an date string of the form (YYYY MON DDTHR:MN:SC

togglePause

Toggles the pause function, i

UTC

Returns the current time as an ISO 8601 date string (YYYY-MM-DDTHH:MN:SS)

Functions

advancedTime

Modifies the passed time (first argument) by the delta time (second argument). The first argument can either be an ISO 8601 date string or the number of seconds past the J2000 epoch. The second argument can either be a string of the form [-]XX(s,m,h,d,M,y] with (s)econds, (m)inutes, (h)ours, (d)ays, (M)onths, and (y)ears as units and an optional - sign to move backwards in time. If the second argument is a number, it is interpreted as a number of seconds. The return value is of the same type as the first argument.

Parameters
  • base String | Number

  • change String | Number

Return type: String | Number

Signature
openspace.time.advancedTime(base, change)

convertTime

Converts the given time to either a J2000 seconds number or a ISO 8601 timestamp, depending on the type of the given time.

If the given time is a timestamp: the function returns a double precision value representing the ephemeris version of that time; that is the number of TDB seconds past the J2000 epoch.

If the given time is a J2000 seconds value: the function returns a ISO 8601 timestamp.

Parameters
  • time String | Number

Return type: String | Number

Signature
openspace.time.convertTime(time)

currentApplicationTime

Returns the current application time as the number of seconds since the OpenSpace application started.

Return type: Number

Signature
openspace.time.currentApplicationTime()

currentTime

Returns the current time as the number of seconds since the J2000 epoch.

Return type: Number

Signature
openspace.time.currentTime()

currentWallTime

Returns the current wall time as an ISO 8601 date string (YYYY-MM-DDTHH-MN-SS) in the UTC timezone.

Return type: String

Signature
openspace.time.currentWallTime()

deltaTime

Returns the amount of simulated time that passes in one second of real time.

Return type: Number

Signature
openspace.time.deltaTime()

interpolateDeltaTime

Sets the amount of simulation time that happens in one second of real time. If a second input value is given, the interpolation is done over the specified number of seconds.

Parameters
  • deltaTime Number

  • interpolationDuration Number?

Return type: void

Signature
openspace.time.interpolateDeltaTime(deltaTime, interpolationDuration)

interpolateNextDeltaTimeStep

Interpolate the simulation speed to the first delta time step in the list that is larger than the current simulation speed, if any. If an input value is given, the interpolation is done over the specified number of seconds.

Parameters
  • interpolationDuration Number?

Return type: void

Signature
openspace.time.interpolateNextDeltaTimeStep(interpolationDuration)

interpolatePause

Same behaviour as setPause, but with interpolation. If no interpolation duration is provided, the interpolation time will be based on the defaultPauseInterpolationDuration and defaultUnpauseInterpolationDuration properties of the TimeManager.

Parameters
  • isPaused Boolean

  • interpolationDuration Number?

Return type: void

Signature
openspace.time.interpolatePause(isPaused, interpolationDuration)

interpolatePreviousDeltaTimeStep

Interpolate the simulation speed to the first delta time step in the list that is smaller than the current simulation speed, if any. If an input value is given, the interpolation is done over the specified number of seconds.

Parameters
  • interpolationDuration Number?

Return type: void

Signature
openspace.time.interpolatePreviousDeltaTimeStep(interpolationDuration)

interpolateTime

Sets the current simulation time to the specified value. If the first parameter is a number, the target is the number of seconds past the J2000 epoch. If it is a string, it has to be a valid ISO 8601-like date string of the format YYYY-MM-DDTHH:MN:SS (Note: providing time zone using the Z format is not supported. UTC is assumed). If a second input value is given, the interpolation is done over the specified number of seconds.

Parameters
  • time String | Number

  • interpolationDutation Number?

Return type: void

Signature
openspace.time.interpolateTime(time, interpolationDutation)

interpolateTimeRelative

Increments the current simulation time by the specified number of seconds. If a second input value is given, the interpolation is done over the specified number of seconds.

Parameters
  • delta Number

  • interpolationDuration Number?

Return type: void

Signature
openspace.time.interpolateTimeRelative(delta, interpolationDuration)

interpolateTogglePause

Toggles the pause function, i.e. temporarily setting the delta time to 0 and restoring it afterwards. If an input value is given, the interpolation is done over the specified number of seconds.

Parameters
  • interpolationDuration Number?

Return type: void

Signature
openspace.time.interpolateTogglePause(interpolationDuration)

isPaused

Returns whether the simulation time is currently paused or is progressing.

Return type: Boolean

Signature
openspace.time.isPaused()

pauseToggleViaKeyboard

This allows for a keypress (via keybinding) to have dual functionality. In normal operational mode it will behave just like time_interpolateTogglePause, but during playback of a session recording it will pause the playback without manipulating the delta time.

Return type: void

Signature
openspace.time.pauseToggleViaKeyboard()

setDeltaTime

Sets the amount of simulation time that happens in one second of real time.

Parameters
  • deltaTime Number

Return type: void

Signature
openspace.time.setDeltaTime(deltaTime)

setDeltaTimeSteps

Sets the list of discrete delta time steps for the simulation speed that can be quickly jumped between. The list will be sorted to be in increasing order. A negative verison of each specified time step will be added per default as well.

Parameters
  • deltaTime Number[]

Return type: void

Signature
openspace.time.setDeltaTimeSteps(deltaTime)

setNextDeltaTimeStep

Immediately set the simulation speed to the first delta time step in the list that is larger than the current choice of simulation speed, if any.

Return type: void

Signature
openspace.time.setNextDeltaTimeStep()

setPause

Toggles a pause function i.e. setting the delta time to 0 and restoring it afterwards.

Parameters
  • isPaused Boolean

Return type: void

Signature
openspace.time.setPause(isPaused)

setPreviousDeltaTimeStep

Immediately set the simulation speed to the first delta time step in the list that is smaller than the current choice of simulation speed if any.

Return type: void

Signature
openspace.time.setPreviousDeltaTimeStep()

setTime

Sets the current simulation time to the specified value. If the parameter is a number, the value is the number of seconds past the J2000 epoch. If it is a string, it has to be a valid ISO 8601-like date string of the format YYYY-MM-DDTHH:MN:SS. Note: providing time zone using the Z format is not supported. UTC is assumed.

Parameters
  • time Number | String

Return type: void

Signature
openspace.time.setTime(time)

SPICE

Returns the current time as an date string of the form (YYYY MON DDTHR:MN:SC.### ::RND) as returned by SPICE.

Return type: String

Signature
openspace.time.SPICE()

togglePause

Toggles the pause function, i.e. temporarily setting the delta time to 0 and restoring it afterwards.

Return type: void

Signature
openspace.time.togglePause()

UTC

Returns the current time as an ISO 8601 date string (YYYY-MM-DDTHH:MN:SS).

Return type: String

Signature
openspace.time.UTC()