|
Packit |
96c956 |
/*
|
|
Packit |
96c956 |
chronyd/chronyc - Programs for keeping computer clocks accurate.
|
|
Packit |
96c956 |
|
|
Packit |
96c956 |
**********************************************************************
|
|
Packit |
96c956 |
* Copyright (C) Miroslav Lichvar 2016
|
|
Packit |
96c956 |
*
|
|
Packit |
96c956 |
* This program is free software; you can redistribute it and/or modify
|
|
Packit |
96c956 |
* it under the terms of version 2 of the GNU General Public License as
|
|
Packit |
96c956 |
* published by the Free Software Foundation.
|
|
Packit |
96c956 |
*
|
|
Packit |
96c956 |
* This program is distributed in the hope that it will be useful, but
|
|
Packit |
96c956 |
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
96c956 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
96c956 |
* General Public License for more details.
|
|
Packit |
96c956 |
*
|
|
Packit |
96c956 |
* You should have received a copy of the GNU General Public License along
|
|
Packit |
96c956 |
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
Packit |
96c956 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
Packit |
96c956 |
*
|
|
Packit |
96c956 |
**********************************************************************
|
|
Packit |
96c956 |
|
|
Packit |
96c956 |
=======================================================================
|
|
Packit |
96c956 |
|
|
Packit |
96c956 |
Header for tracking of hardware clocks */
|
|
Packit |
96c956 |
|
|
Packit |
96c956 |
#ifndef GOT_HWCLOCK_H
|
|
Packit |
96c956 |
#define GOT_HWCLOCK_H
|
|
Packit |
96c956 |
|
|
Packit |
96c956 |
typedef struct HCL_Instance_Record *HCL_Instance;
|
|
Packit |
96c956 |
|
|
Packit |
96c956 |
/* Create a new HW clock instance */
|
|
Packit |
96c956 |
extern HCL_Instance HCL_CreateInstance(int min_samples, int max_samples,
|
|
Packit |
96c956 |
double min_separation);
|
|
Packit |
96c956 |
|
|
Packit |
96c956 |
/* Destroy a HW clock instance */
|
|
Packit |
96c956 |
extern void HCL_DestroyInstance(HCL_Instance clock);
|
|
Packit |
96c956 |
|
|
Packit |
96c956 |
/* Check if a new sample should be accumulated at this time */
|
|
Packit |
96c956 |
extern int HCL_NeedsNewSample(HCL_Instance clock, struct timespec *now);
|
|
Packit |
96c956 |
|
|
Packit |
96c956 |
/* Accumulate a new sample */
|
|
Packit |
96c956 |
extern void HCL_AccumulateSample(HCL_Instance clock, struct timespec *hw_ts,
|
|
Packit |
96c956 |
struct timespec *local_ts, double err);
|
|
Packit |
96c956 |
|
|
Packit |
96c956 |
/* Convert raw hardware time to cooked local time */
|
|
Packit |
96c956 |
extern int HCL_CookTime(HCL_Instance clock, struct timespec *raw, struct timespec *cooked,
|
|
Packit |
96c956 |
double *err);
|
|
Packit |
96c956 |
|
|
Packit |
96c956 |
#endif
|