code: def update(self, source_clock_sample, target_clock_sample):
          
          pi = float(self._source_time_resolver.update(source_clock_sample, target_clock_sample))
          qi = target_clock_sample
  
          # Initialization
          if self._p is None:
              self._p = pi
              self._q = qi
  
          # Sync error - refer to the reference implementation of the algorithm
          self._estimated_delay = abs((pi - self._p) - (qi - self._q))
  
          # Resynchronization (discarding known state)
          if self._estimated_delay > self.max_phase_error_to_resync:
              self._source_time_resolver.reset()
              self._resync_count += 1
              self._p = pi = float(self._source_time_resolver.update(source_clock_sample, target_clock_sample))
              self._q = qi
  
          # Offset options
          assert pi >= self._p
          offset = self._p - self._q - self.max_rate_error * (pi - self._p) - self.fixed_delay
          new_offset = pi - qi - self.fixed_delay
  
          # Updating p/q if the new offset is lower by magnitude
          if new_offset >= offset:
              offset = new_offset
              self._p = pi
              self._q = qi
  
          ti = pi - offset
  
          return ti
docs: Args:
              source_clock_sample:    E.g. value received from the source system, in seconds
              target_clock_sample:    E.g. target time sampled when the data arrived to the local system, in seconds
          Returns: Event timestamp converted to the target time domain.