Exemple #1
0
    def get_new_estimate(self):
        """Perform an update-cycle toward achieving time-synchronization.

        Return:
            Boolean true if valid timesync has been established.
        """
        response = self._get_update()
        rx_time = now_nsec()

        # Record the timing information for this GRPC call to pass to the next update
        round_trip = time_sync_pb2.TimeSyncRoundTrip()
        # pylint: disable=no-member
        round_trip.client_tx.CopyFrom(
            response.header.request_header.request_timestamp)
        round_trip.server_rx.CopyFrom(
            response.header.request_received_timestamp)
        round_trip.server_tx.CopyFrom(response.header.response_timestamp)
        set_timestamp_from_nsec(round_trip.client_rx, rx_time)

        with self._lock:
            self._locked_previous_round_trip = round_trip
            # Store the response to get clock-skew estimate, etc.
            self._locked_previous_response = response
            self._locked_clock_identifier = response.clock_identifier

        return self.has_established_time_sync
Exemple #2
0
 def _create_header(self):
     header = RequestHeader()
     header.client_name = self.get_client_name()
     set_timestamp_from_nsec(header.request_timestamp, now_nsec())
     return header