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 org.wpilib.networktables;
006
007/** NetworkTables time sync event data. */
008public final class TimeSyncEventData {
009  /**
010   * Offset between local time and server time, in microseconds. Add this value to local time to get
011   * the estimated equivalent server time.
012   */
013  public final long serverTimeOffset;
014
015  /** Measured round trip time divided by 2, in microseconds. */
016  public final long rtt2;
017
018  /**
019   * If serverTimeOffset and RTT are valid. An event with this set to false is sent when the client
020   * disconnects.
021   */
022  public final boolean valid;
023
024  /**
025   * Constructor. This should generally only be used internally to NetworkTables.
026   *
027   * @param serverTimeOffset Server time offset
028   * @param rtt2 Round trip time divided by 2
029   * @param valid If other parameters are valid
030   */
031  public TimeSyncEventData(long serverTimeOffset, long rtt2, boolean valid) {
032    this.serverTimeOffset = serverTimeOffset;
033    this.rtt2 = rtt2;
034    this.valid = valid;
035  }
036}