Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update core Open MCT Time API methods #284

Open
jvigliotta opened this issue Feb 19, 2025 · 0 comments
Open

Update core Open MCT Time API methods #284

jvigliotta opened this issue Feb 19, 2025 · 0 comments

Comments

@jvigliotta
Copy link
Collaborator

jvigliotta commented Feb 19, 2025

Describe the sustaining activity
Core Open MCT time api methods have been updated and the older ones will be deprecated in the future. We need to update usage in our code.

TimeAPI Method Updates

The following methods in OpenMCT's TimeAPI have been deprecated and should be updated to use their newer counterparts:

  1. timeSystem(timeSystemOrKey, bounds) → Split into:

    • getTimeSystem()
    • setTimeSystem(timeSystemOrKey, bounds)
  2. bounds(newBounds) → Split into:

    • getBounds()
    • setBounds(newBounds)
  3. clockOffsets(offsets) → Split into:

    • getClockOffsets()
    • setClockOffsets(offsets)
  4. clock(keyOrClock, offsets) → Split into:

    • getClock()
    • setClock(keyOrClock)
    • Note: Clock offsets are now set separately using setClockOffsets()
  5. stopClock() → Replace with:

    • setMode(FIXED_MODE_KEY)

Example Code Update

// Old code
openmct.time.timeSystem('utc', bounds);
openmct.time.clock('local', offsets);
// New code
openmct.time.setTimeSystem('utc', bounds);
openmct.time.setClock('local');
openmct.time.setClockOffsets(offsets);

TimeAPI Event Updates

The following TimeAPI events have been deprecated and should be updated to use their newer counterparts:

  1. 'bounds''boundsChanged'

    // Old
    openmct.time.on('bounds', (bounds, isTick) => {});
    // New
    openmct.time.on('boundsChanged', (bounds, isTick) => {});
  2. 'clock''clockChanged'

    // Old
    openmct.time.on('clock', (clock) => {});
    // New
    openmct.time.on('clockChanged', (clock) => {});
  3. 'timeSystem''timeSystemChanged'

    // Old
    openmct.time.on('timeSystem', (timeSystem) => {});
    // New
    openmct.time.on('timeSystemChanged', (timeSystem) => {});
  4. 'clockOffsets''clockOffsetsChanged'

    // Old
    openmct.time.on('clockOffsets', (offsets) => {});
    // New
    openmct.time.on('clockOffsetsChanged', (offsets) => {});

Additional Events

The following events remain unchanged or are new:

  • 'tick' - Emitted when a clock tick occurs
  • 'modeChanged' - Emitted when the time mode changes (fixed vs. realtime)

Expected behavior

Testing Instructions
1.

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant