* include/sys/timex.h
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __INCLUDE_SYS_TIMEX_H
#define __INCLUDE_SYS_TIMEX_H
* Included Files
****************************************************************************/
#include <sys/time.h>
* Pre-processor Definitions
****************************************************************************/
#define ADJ_OFFSET 0x0001
#define ADJ_FREQUENCY 0x0002
#define ADJ_MAXERROR 0x0004
#define ADJ_ESTERROR 0x0008
#define ADJ_STATUS 0x0010
#define ADJ_TIMECONST 0x0020
#define ADJ_TAI 0x0080
#define ADJ_SETOFFSET 0x0100
#define ADJ_MICRO 0x1000
#define ADJ_NANO 0x2000
#define ADJ_TICK 0x4000
#define ADJ_OFFSET_SINGLESHOT 0x8001
#define ADJ_OFFSET_SS_READ 0xa001
* Public Types
****************************************************************************/
struct timex
{
unsigned int modes;
long offset;
long freq;
long maxerror;
long esterror;
int status;
long constant;
long precision;
long tolerance;
struct timeval time;
long tick;
long ppsfreq;
long jitter;
int shift;
long stabil;
long jitcnt;
long calcnt;
long errcnt;
long stbcnt;
int tai;
};
* Public Function Prototypes
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
* Name: clock_adjtime
*
* Description:
* Adjust the frequency and/or phase of a clock.
* This function allows the adjustment of the frequency and/or phase of a
* specified clock. It can be used to synchronize the clock with an
* external time source or to apply a frequency offset.
*
* Input Parameters:
* clk_id - The identifier of the clock to be adjusted. This is typically
* one of the predefined clock IDs such as CLOCK_REALTIME,
* CLOCK_MONOTONIC, or CLOCK_BOOTTIME.
*
* buf - A pointer to a `timex` structure that specifies the adjustment
* parameters. This structure includes fields for the frequency
* adjustment (`freq`), the maximum frequency error (`maxerror`),
* the estimated error (`esterror`), the phase offset (`offset`),
* and flags to indicate the type of adjustment (`status`).
*
* Returned Value:
* Return On success, the function returns 0. On error, it returns
* -1 and sets 'errno` to indicate the specific error that
* occurred.
*
****************************************************************************/
#ifdef CONFIG_CLOCK_ADJTIME
int clock_adjtime(clockid_t clk_id, FAR struct timex *buf);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif