001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package edu.wpi.first.networktables;
006
007/** NetworkTables time sync event data. */
008@SuppressWarnings("MemberName")
009public final class TimeSyncEventData {
010  /**
011   * Offset between local time and server time, in microseconds. Add this value to local time to get
012   * the estimated equivalent server time.
013   */
014  public final long serverTimeOffset;
015
016  /** Measured round trip time divided by 2, in microseconds. */
017  public final long rtt2;
018
019  /**
020   * If serverTimeOffset and RTT are valid. An event with this set to false is sent when the client
021   * disconnects.
022   */
023  public final boolean valid;
024
025  /**
026   * Constructor. This should generally only be used internally to NetworkTables.
027   *
028   * @param serverTimeOffset Server time offset
029   * @param rtt2 Round trip time divided by 2
030   * @param valid If other parameters are valid
031   */
032  public TimeSyncEventData(long serverTimeOffset, long rtt2, boolean valid) {
033    this.serverTimeOffset = serverTimeOffset;
034    this.rtt2 = rtt2;
035    this.valid = valid;
036  }
037}