1570af302Sopenharmony_ci#ifndef _SYS_TIMEX_H 2570af302Sopenharmony_ci#define _SYS_TIMEX_H 3570af302Sopenharmony_ci 4570af302Sopenharmony_ci#ifdef __cplusplus 5570af302Sopenharmony_ciextern "C" { 6570af302Sopenharmony_ci#endif 7570af302Sopenharmony_ci 8570af302Sopenharmony_ci#define __NEED_clockid_t 9570af302Sopenharmony_ci 10570af302Sopenharmony_ci#include <bits/alltypes.h> 11570af302Sopenharmony_ci 12570af302Sopenharmony_ci#include <sys/time.h> 13570af302Sopenharmony_ci 14570af302Sopenharmony_cistruct ntptimeval { 15570af302Sopenharmony_ci struct timeval time; 16570af302Sopenharmony_ci long maxerror, esterror; 17570af302Sopenharmony_ci}; 18570af302Sopenharmony_ci 19570af302Sopenharmony_cistruct timex { 20570af302Sopenharmony_ci unsigned modes; 21570af302Sopenharmony_ci long offset, freq, maxerror, esterror; 22570af302Sopenharmony_ci int status; 23570af302Sopenharmony_ci long constant, precision, tolerance; 24570af302Sopenharmony_ci struct timeval time; 25570af302Sopenharmony_ci long tick, ppsfreq, jitter; 26570af302Sopenharmony_ci int shift; 27570af302Sopenharmony_ci long stabil, jitcnt, calcnt, errcnt, stbcnt; 28570af302Sopenharmony_ci int tai; 29570af302Sopenharmony_ci int __padding[11]; 30570af302Sopenharmony_ci}; 31570af302Sopenharmony_ci 32570af302Sopenharmony_ci#define ADJ_OFFSET 0x0001 33570af302Sopenharmony_ci#define ADJ_FREQUENCY 0x0002 34570af302Sopenharmony_ci#define ADJ_MAXERROR 0x0004 35570af302Sopenharmony_ci#define ADJ_ESTERROR 0x0008 36570af302Sopenharmony_ci#define ADJ_STATUS 0x0010 37570af302Sopenharmony_ci#define ADJ_TIMECONST 0x0020 38570af302Sopenharmony_ci#define ADJ_TAI 0x0080 39570af302Sopenharmony_ci#define ADJ_SETOFFSET 0x0100 40570af302Sopenharmony_ci#define ADJ_MICRO 0x1000 41570af302Sopenharmony_ci#define ADJ_NANO 0x2000 42570af302Sopenharmony_ci#define ADJ_TICK 0x4000 43570af302Sopenharmony_ci#define ADJ_OFFSET_SINGLESHOT 0x8001 44570af302Sopenharmony_ci#define ADJ_OFFSET_SS_READ 0xa001 45570af302Sopenharmony_ci 46570af302Sopenharmony_ci#define MOD_OFFSET ADJ_OFFSET 47570af302Sopenharmony_ci#define MOD_FREQUENCY ADJ_FREQUENCY 48570af302Sopenharmony_ci#define MOD_MAXERROR ADJ_MAXERROR 49570af302Sopenharmony_ci#define MOD_ESTERROR ADJ_ESTERROR 50570af302Sopenharmony_ci#define MOD_STATUS ADJ_STATUS 51570af302Sopenharmony_ci#define MOD_TIMECONST ADJ_TIMECONST 52570af302Sopenharmony_ci#define MOD_CLKB ADJ_TICK 53570af302Sopenharmony_ci#define MOD_CLKA ADJ_OFFSET_SINGLESHOT 54570af302Sopenharmony_ci#define MOD_TAI ADJ_TAI 55570af302Sopenharmony_ci#define MOD_MICRO ADJ_MICRO 56570af302Sopenharmony_ci#define MOD_NANO ADJ_NANO 57570af302Sopenharmony_ci 58570af302Sopenharmony_ci#define STA_PLL 0x0001 59570af302Sopenharmony_ci#define STA_PPSFREQ 0x0002 60570af302Sopenharmony_ci#define STA_PPSTIME 0x0004 61570af302Sopenharmony_ci#define STA_FLL 0x0008 62570af302Sopenharmony_ci 63570af302Sopenharmony_ci#define STA_INS 0x0010 64570af302Sopenharmony_ci#define STA_DEL 0x0020 65570af302Sopenharmony_ci#define STA_UNSYNC 0x0040 66570af302Sopenharmony_ci#define STA_FREQHOLD 0x0080 67570af302Sopenharmony_ci 68570af302Sopenharmony_ci#define STA_PPSSIGNAL 0x0100 69570af302Sopenharmony_ci#define STA_PPSJITTER 0x0200 70570af302Sopenharmony_ci#define STA_PPSWANDER 0x0400 71570af302Sopenharmony_ci#define STA_PPSERROR 0x0800 72570af302Sopenharmony_ci 73570af302Sopenharmony_ci#define STA_CLOCKERR 0x1000 74570af302Sopenharmony_ci#define STA_NANO 0x2000 75570af302Sopenharmony_ci#define STA_MODE 0x4000 76570af302Sopenharmony_ci#define STA_CLK 0x8000 77570af302Sopenharmony_ci 78570af302Sopenharmony_ci#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ 79570af302Sopenharmony_ci STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK) 80570af302Sopenharmony_ci 81570af302Sopenharmony_ci#define TIME_OK 0 82570af302Sopenharmony_ci#define TIME_INS 1 83570af302Sopenharmony_ci#define TIME_DEL 2 84570af302Sopenharmony_ci#define TIME_OOP 3 85570af302Sopenharmony_ci#define TIME_WAIT 4 86570af302Sopenharmony_ci#define TIME_ERROR 5 87570af302Sopenharmony_ci#define TIME_BAD TIME_ERROR 88570af302Sopenharmony_ci 89570af302Sopenharmony_ci#define MAXTC 6 90570af302Sopenharmony_ci 91570af302Sopenharmony_ciint adjtimex(struct timex *); 92570af302Sopenharmony_ciint clock_adjtime(clockid_t, struct timex *); 93570af302Sopenharmony_ci 94570af302Sopenharmony_ci#if _REDIR_TIME64 95570af302Sopenharmony_ci__REDIR(adjtimex, __adjtimex_time64); 96570af302Sopenharmony_ci__REDIR(clock_adjtime, __clock_adjtime64); 97570af302Sopenharmony_ci#endif 98570af302Sopenharmony_ci 99570af302Sopenharmony_ci#ifdef __cplusplus 100570af302Sopenharmony_ci} 101570af302Sopenharmony_ci#endif 102570af302Sopenharmony_ci 103570af302Sopenharmony_ci#endif 104