blob: b4a4fa7f96557927e1a86f5d5157f9f4b5ff48d5 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package clock
import (
"time"
)
// ClockData is the persistent state of syncbase clock used to estimate current
// NTP time and catch any unexpected changes to system clock.
type ClockData struct {
// UTC time in unix nano seconds obtained from system clock at boot.
SystemTimeAtBoot int64
// Skew in nanoseconds between the system clock and NTP time.
Skew int64
// The elapsed time in nanoseconds since boot as last seen during a run of
// clockservice. This is used to determine if the device rebooted since the
// last run of clockservice.
ElapsedTimeSinceBoot int64
// Timestamp received from NTP during last NTP sync. The last NTP sync could
// be done either by this device or some other device that this device
// synced its clock with.
LastNtpTs ?time.Time
// Number of cumulative reboots since last NTP sync. If the LastNtpTs was
// received from a peer device then this field represents the number
// of reboots on that device since it did NTP and the number of reboots
// on this device since syncing with the peer device.
NumReboots uint16
// Number of hops between this device and the device that did the last
// NTP sync.
NumHops uint16
}