code: function useOwnClockChanged(catalogItem) {
    // If we are changing the state, copy the time from the clock that was in use to the clock that will be in use.
    if (catalogItem._lastUseOwnClock !== catalogItem.useOwnClock) {
      // Check that both clocks are defined before syncing the time (they may not both be defined during load due to construction order).
      if (
        defined(catalogItem.clock) &&
        defined(catalogItem.terria) &&
        defined(catalogItem.terria.clock) &&
        defined(catalogItem.terria.clock.currentTime)
      ) {
        if (catalogItem.useOwnClock) {
          // This is probably not needed, since we should be doing it on update, but just do this here explicitly
          // to be sure it is immediately current before we change.
          updateCurrentTime(catalogItem, catalogItem.terria.clock.currentTime);
        } else {
          catalogItem.terria.clock.currentTime = JulianDate.clone(
            catalogItem.clock.currentTime
          );
        }
  
        catalogItem._lastUseOwnClock = catalogItem.useOwnClock;
  
        catalogItem.useClock();
      }
    }
  }
docs: Syncs the time between the terria.clock and the catalogItem.clock.
  
  The sync is performed in the direction that is required depending on the state change true->false / false->true of useOwnClock.
  
  @param catalogItem The CatalogItem to sync the time for.
  @private