PPS-Client  2.0.0
Client for synchronizing the system clock to a GPS PPS source
pps-client.h
Go to the documentation of this file.
1 
7 /*
8  * Copyright (C) 2016-2020 Raymond S. Connell
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License along
21  * with this program; if not, write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24 
25 #ifndef PPS_CLIENT_H_
26 #define PPS_CLIENT_H_
27 
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <time.h>
31 #include <unistd.h>
32 #include <pthread.h>
33 #include <signal.h>
34 #include <string.h>
35 #include <sys/stat.h>
36 #include <fcntl.h>
37 #include <sys/timex.h>
38 #include <sys/time.h>
39 #include <math.h>
40 #include <sys/types.h>
41 #include <errno.h>
42 #include <poll.h>
43 #include <sys/mman.h>
44 #include "timepps.h"
45 #include <inttypes.h>
46 
47 #define USECS_PER_SEC 1000000
48 #define SECS_PER_MINUTE 60
49 #define SECS_PER_5_MIN 300
50 #define SECS_PER_10_MIN 600
51 #define SECS_PER_HOUR 3600
52 #define SECS_PER_DAY 86400
53 #define NUM_5_MIN_INTERVALS 288
54 #define FIVE_MINUTES 5
55 #define PER_MINUTE (1.0 / (double)SECS_PER_MINUTE)
56 #define SETTLE_TIME (2 * SECS_PER_10_MIN)
57 #define INV_GAIN_1 1
58 #define INV_GAIN_0 4
59 #define INTEGRAL_GAIN 0.63212
60 #define FREQDIFF_INTRVL 5
61 #define PPS_WINDOW 500
62 #define PTHREAD_STACK_REQUIRED 16384
63 
64 #define ZERO_OFFSET_RPI3 8
65 #define ZERO_OFFSET_RPI4 4
66 
67 #define OFFSETFIFO_LEN 80
68 #define NUM_INTEGRALS 10
69 #define PER_NUM_INTEGRALS (1.0 / (double)NUM_INTEGRALS)
70 
71 #define ADJTIMEX_SCALE 65536.0
72 
73 #define RAW_ERROR_ZERO 20
74 #define RAW_ERROR_DECAY 0.98851
75 
76 #define INTERRUPT_LOST 15
77 
78 #define MAX_SERVERS 4
79 #define CHECK_TIME 1024
80 #define BLOCK_FOR_10 10
81 #define BLOCK_FOR_3 3
82 #define CHECK_TIME_SERIAL 10
83 
84 #define MAX_SPIKES 60
85 #define MAX_SPIKE_LEVEL 1000000
86 #define CLK_CHANGED_LEVEL 1000
87 
88 #define LARGE_SPIKE 80
89 #define NOISE_ACCUM_RATE 0.1
90 #define NOISE_LEVEL_MIN 4
91 #define SLEW_LEN 10
92 #define SLEW_MAX 300
93 
94 #define MAX_LINE_LEN 50
95 #define STRBUF_SZ 1000
96 #define LOGBUF_SZ 1000
97 #define MSGBUF_SZ 1000
98 #define NIST_MSG_SZ 200
99 #define CONFIG_FILE_SZ 10000
100 
101 #define NUM_PARAMS 5
102 #define ERROR_DISTRIB_LEN 121
103 #define JITTER_DISTRIB_LEN 181
104 #define INTRPT_DISTRIB_LEN 121
105 
106 #define HARD_LIMIT_NONE 32768
107 #define HARD_LIMIT_1024 1024
108 #define HARD_LIMIT_4 4
109 #define HARD_LIMIT_1 1
110 
111 #define HIGH 1
112 #define LOW 0
113 
114 #define MAX_CONFIGS 32
115 
116 #define ERROR_DISTRIB 1 // Configuration file Keys
117 #define ALERT_PPS_LOST 2
118 #define JITTER_DISTRIB 4
119 #define EXIT_LOST_PPS 8
120 #define PPS_GPIO 16
121 #define OUTPUT_GPIO 32
122 #define INTRPT_GPIO 64
123 #define NIST 128
124 #define SERIAL 256
125 #define SERIAL_PORT 512
126 #define EXECDIR 1024
127 #define SERVICEDIR 2048
128 #define CONFIGDIR 4096
129 #define DOCDIR 8192
130 #define RUNDIR 16384
131 #define SHMDIR 32768
132 #define TSTDIR 65536
133 #define LOGDIR 131072
134 #define PPSDELAY 262144
135 #define MODULEDIR 524288
136 #define PPSDEVICE 1048576
137 #define PPSPHASE 2097152
138 #define PROCDIR 4194304
139 #define SEGREGATE 8388608
140 
141 
142 /*
143  * Struct for passing arguments to and from threads
144  * querying time servers.
145  */
147  pthread_t *tid;
148  pthread_attr_t attr;
151  char **ntp_server;
152  char *serialPort;
153  char *buf;
155  char *strbuf;
156  char *logbuf;
157  bool *threadIsBusy;
158  int rv;
159  char *gmtTime_file;
162 };
163 
164 /*
165  * Struct for program-wide global variables.
166  */
167 struct G {
168  int nCores;
169  int useCore;
171 
172  bool isVerbose;
173 
175 
176  unsigned int seq_num;
177 
179 
181  unsigned int activeCount;
182 
186 
187  struct timeval t;
188 
189  int tm[6];
190 
191  int t_now;
192  int t_count;
193  double t_mono_now;
194  double t_mono_last;
195 
197  double noiseLevel;
199  int ppsPhase;
200 
201  int rawError;
202 
204  unsigned int ppsCount;
205 
210 
211  double slewAccum;
213  double avgSlew;
214  bool slewIsLow;
215 
216  int zeroError;
217  int hardLimit;
219 
222  struct timex t3;
223 
224  double avgCorrection;
228 
230  double avgIntegral;
233 
234  double integralGain;
236  double freqOffset;
237 
241 
245 
246  char linuxVersion[20];
247 
250  int startingFromRestore;
251 
252  char logbuf[LOGBUF_SZ];
253  char msgbuf[MSGBUF_SZ];
254  char savebuf[MSGBUF_SZ];
255  char strbuf[STRBUF_SZ];
256  char *configVals[MAX_CONFIGS];
257 
258  bool exit_requested;
259  bool exitOnLostPPS;
260  bool exit_loop;
261 
262  int blockDetectClockChange;
263 
264  int recIndex;
265  int recIndex2;
266 
267  time_t pps_t_sec;
268  int pps_t_usec;
269 
270  unsigned int config_select;
271 
272  int intervalCount;
273 
274  int jitter;
275 
276  int seq_numRec[SECS_PER_10_MIN];
277 
278  double lastFreqOffset;
279  double freqOffsetSum;
280  double freqOffsetDiff[FREQDIFF_INTRVL];
281 
282  unsigned int lastActiveCount;
283 
284  int delayLabel[NUM_PARAMS];
285 
286  int interruptDistrib[INTRPT_DISTRIB_LEN];
287  int interruptCount;
288 
289  int jitterDistrib[JITTER_DISTRIB_LEN];
290  int jitterCount;
291 
292  int errorDistrib[ERROR_DISTRIB_LEN];
293  int errorCount;
294  bool queryWait;
295 
296  double freqAllanDev[NUM_5_MIN_INTERVALS];
297  double freqOffsetRec[NUM_5_MIN_INTERVALS];
298  double freqOffsetRec2[SECS_PER_10_MIN];
299  __time_t timestampRec[NUM_5_MIN_INTERVALS];
300  int offsetRec[SECS_PER_10_MIN];
301  char serialPort[50];
302  char configBuf[CONFIG_FILE_SZ];
306 };
307 
313 time_t getServerTime(const char *, int, char *, char *);
317 
321 
326 struct saveFileData {
327  const char *label;
328  void *array;
329  const char *filename;
330  int arrayLen;
331  int arrayType;
332  int arrayZero;
333 };
334 
338 struct ppsFiles {
339  char last_distrib_file[100];
340  char distrib_file[100];
341  char last_jitter_distrib_file[100];
342  char jitter_distrib_file[100];
343  char log_file[100];
344  char old_log_file[100];
345  char pidFilename[100];
346  char config_file[100];
347  char assert_file[100];
348  char displayParams_file[100];
349  char arrayData_file[100];
350  char pps_device[100];
351  char module_file[100];
352  char pps_msg_file[100];
353  char linuxVersion_file[50];
354  char gmtTime_file[50];
355  char nistTime_file[50];
356  char integral_state_file[50];
357  char home_file[50];
358  char cpuinfo_file[50];
359 };
360 
361 struct intPair {
362  int val;
363  int nVals;
364 };
365 
369 class List {
370 
371 private:
372  int ln;
373  int size;
374  int count;
375 
376  void insert(int idx, int val){
377  for (int i = ln; i >= idx; i--){
378  lst[i+1] = lst[i];
379  }
380  lst[idx].val = val;
381  lst[idx].nVals = 1;
382  ln += 1;
383  }
384 
385 public:
386  struct intPair *lst;
387 
388  void clear(void){
389  for (int i = 0; i < size; i++){
390  lst[i].val = 0;
391  lst[i].nVals = 0;
392  }
393  ln = 0;
394  count = 0;
395  }
396 
397  List(int sz){
398  size = sz;
399  lst = new intPair[size];
400 
401  clear();
402  }
403 
404  ~List(){
405  delete[] lst;
406  }
407 
408  int binaryInsert(int val);
409  double averageBelow(int maxVal);
410 };
411 
412 int sysCommand(const char *);
413 void initSerialLocalData(void);
414 void bufferStatusMsg(const char *);
415 int writeStatusStrings(void);
416 bool ppsIsRunning(void);
417 int writeFileMsgToLog(const char *);
418 int writeFileMsgToLogbuf(const char *, char *);
419 void writeToLog(char *, const char *);
420 pid_t getChildPID(void);
421 int createPIDfile(void);
422 void writeOffsets(void);
423 void writeTimestamp(double);
424 int bufferStateParams(void);
425 int disableNTP(void);
426 int enableNTP(void);
427 int open_logerr(const char*, int, const char *);
428 int read_logerr(int fd, char *, int, const char *);
429 void writeInterruptDistribFile(void);
430 int getConfigs(void);
431 bool isEnabled(int);
432 bool isDisabled(int);
433 void writeSysdelayDistribFile(void);
434 void showStatusEachSecond(void);
435 struct timespec setSyncDelay(int, int);
436 int accessDaemon(int argc, char *argv[]);
437 void buildErrorDistrib(int);
438 void buildJitterDistrib(int);
439 void TERMhandler(int);
440 void HUPhandler(int);
441 void buildInterruptJitterDistrib(int);
442 void recordFrequencyVars(void);
443 void recordOffsets(int timeCorrection);
444 void writeToLogNoTimestamp(char *);
445 int getTimeErrorOverSerial(int *);
446 int find_source(const char *path, pps_handle_t *handle, int *avail_mode);
447 int readPPSTimestamp(pps_handle_t *handle, int *avail_mode, int *tm);
448 void saveGPSTime(timeCheckParams *tcp);
449 int saveLastState(void);
450 int loadLastState(void);
451 int getRootHome(void);
452 int getRPiCPU(void);
453 int assignProcessorAffinity(void);
457 #endif /* PPS_CLIENT_H_ */
G::slewIsLow
bool slewIsLow
Set to "true" in getAcquireState() when G.avgSlew is less than SLEW_MAX. This is a precondition for g...
Definition: pps-client.h:214
G::rawErrorDistrib
double rawErrorDistrib[ERROR_DISTRIB_LEN]
The distribution of rawError values accumulated in buildRawErrorDistrib().
Definition: pps-client.h:203
G::integral
double integral[NUM_INTEGRALS]
Array of integrals constructed by makeAverageIntegral().
Definition: pps-client.h:229
OFFSETFIFO_LEN
#define OFFSETFIFO_LEN
Length of G.correctionFifo which contains the data used to generate G.avgCorrection.
Definition: pps-client.h:67
G::correctionAccum
int correctionAccum
Accumulates G.timeCorrection values from G.correctionFifo in getMovingAverage() in order to generate ...
Definition: pps-client.h:227
NUM_PARAMS
#define NUM_PARAMS
Definition: pps-client.h:101
timeCheckParams::logbuf
char * logbuf
Space for returned log messages.
Definition: pps-client.h:156
timeCheckParams::serialPort
char * serialPort
The serial port filename when serial time is used.
Definition: pps-client.h:152
timeCheckParams
Definition: pps-client.h:146
HUPhandler
void HUPhandler(int sig)
Definition: pps-files.cpp:2350
G::hardLimit
int hardLimit
An adaptive limit value determined by setHardLimit() and applied to G.rawError by clampJitter() as th...
Definition: pps-client.h:217
cpuinfo_file
const char * cpuinfo_file
Definition: pps-files.cpp:44
accessDaemon
int accessDaemon(int argc, char *argv[])
Definition: pps-files.cpp:2238
G::activeCount
unsigned int activeCount
Advancing count of active (not skipped) controller cycles once G.isControlling is "true".
Definition: pps-client.h:181
recordFrequencyVars
void recordFrequencyVars(void)
Definition: pps-files.cpp:2366
isEnabled
bool isEnabled(int key)
Definition: pps-files.cpp:275
G::correctionFifoCount
int correctionFifoCount
Signals that G.correctionFifo contains a full count of G.timeCorrection values.
Definition: pps-client.h:226
timeCheckParams::serverIndex
int serverIndex
Identifying index from the list of active NIST servers.
Definition: pps-client.h:149
freeSerialThread
void freeSerialThread(timeCheckParams *tcp)
Definition: pps-serial.cpp:464
G::invProportionalGain
int invProportionalGain
Controller proportional gain configured inversely to use as an int divisor.
Definition: pps-client.h:220
G::freqOffset
double freqOffset
System clock frequency correction calculated as G.integralTimeCorrection * G.integralGain.
Definition: pps-client.h:236
G::doNISTsettime
bool doNISTsettime
Definition: pps-client.h:238
NUM_INTEGRALS
#define NUM_INTEGRALS
Number of integrals used by makeAverageIntegral() to calculate the one minute clock frequency correct...
Definition: pps-client.h:68
sysCommand
int sysCommand(const char *cmd)
Definition: pps-files.cpp:193
read_logerr
int read_logerr(int fd, char *buf, int sz, const char *filename)
Definition: pps-files.cpp:466
freeNISTThreads
void freeNISTThreads(timeCheckParams *tcp)
Definition: pps-sntp.cpp:412
timeCheckParams::attr
pthread_attr_t attr
Thread attribute object.
Definition: pps-client.h:148
writeToLog
void writeToLog(char *logbuf, const char *location)
Definition: pps-files.cpp:364
writeTimestamp
void writeTimestamp(double timestamp)
Definition: pps-files.cpp:1581
allocInitializeNISTThreads
int allocInitializeNISTThreads(timeCheckParams *tcp)
Definition: pps-sntp.cpp:371
timeCheckParams::tid
pthread_t * tid
Thread id.
Definition: pps-client.h:147
G::interruptLossCount
int interruptLossCount
Records the number of consecutive lost PPS interrupt times.
Definition: pps-client.h:185
G::timeCorrection
int timeCorrection
Time correction value constructed in makeTimeCorrection().
Definition: pps-client.h:221
G::seq_num
unsigned int seq_num
Advancing count of the number of PPS interrupt timings that have been received.
Definition: pps-client.h:176
find_source
int find_source(const char *path, pps_handle_t *handle, int *avail_mode)
Definition: pps-files.cpp:2433
displayParams_file
const char * displayParams_file
Temporary file storing params for the status display.
Definition: pps-files.cpp:36
G::zeroError
int zeroError
The controller error resulting from removing jitter noise from G.rawError in removeNoise().
Definition: pps-client.h:216
G::ppsPhase
int ppsPhase
Accounts for a possible hardware inversion of the PPS signal.
Definition: pps-client.h:199
timepps.h
G::nDelaySpikes
int nDelaySpikes
Current count of continuous delay spikes made by detectDelaySpike().
Definition: pps-client.h:206
makeSerialTimeQuery
int makeSerialTimeQuery(timeCheckParams *tcp)
Definition: pps-serial.cpp:312
G::integralTimeCorrection
double integralTimeCorrection
Integral or average integral of G.timeCorrection returned by getIntegral();.
Definition: pps-client.h:235
G::slewAccum
double slewAccum
Accumulates G.rawError in getTimeSlew() and is used to determine G.avgSlew.
Definition: pps-client.h:211
gmtTime_file
const char * gmtTime_file
Definition: pps-files.cpp:40
G::t_mono_last
double t_mono_last
Last recorded monotonic time.
Definition: pps-client.h:194
buildJitterDistrib
void buildJitterDistrib(int rawError)
Definition: pps-files.cpp:2316
saveGPSTime
void saveGPSTime(timeCheckParams *tcp)
Definition: pps-serial.cpp:228
getChildPID
pid_t getChildPID(void)
Definition: pps-files.cpp:804
G::consensusTimeError
int consensusTimeError
Consensus value of whole-second time corrections for DST or leap seconds from Internet NIST servers.
Definition: pps-client.h:240
assignProcessorAffinity
int assignProcessorAffinity(void)
Definition: pps-files.cpp:1877
G::correctionFifo_idx
int correctionFifo_idx
Advances G.correctionFifo on each controller cycle in integralIsReady() which returns "true" every 60...
Definition: pps-client.h:232
makeNISTTimeQuery
void makeNISTTimeQuery(timeCheckParams *tcp)
Definition: pps-sntp.cpp:300
G::ppsCount
unsigned int ppsCount
Advancing count of G.rawErrorDistrib[] entries made by buildRawErrorDistrib().
Definition: pps-client.h:204
G::clampAbsolute
bool clampAbsolute
Hard limit relative to zero if true else relative to average G.rawError.
Definition: pps-client.h:218
ERROR_DISTRIB_LEN
#define ERROR_DISTRIB_LEN
Definition: pps-client.h:102
G::t_count
int t_count
Rounded seconds counted at the time of G.t_now.
Definition: pps-client.h:192
MAX_CONFIGS
#define MAX_CONFIGS
Definition: pps-client.h:114
writeFileMsgToLogbuf
int writeFileMsgToLogbuf(const char *filename, char *logbuf)
Definition: pps-files.cpp:750
timeCheckParams::doReadSerial
bool doReadSerial
Flag to read serial messages from serial port.
Definition: pps-client.h:154
G::integralCount
int integralCount
Counts the integrals formed over the last 10 controller cycles and signals when all integrals in G....
Definition: pps-client.h:231
distrib_file
const char * distrib_file
Stores a forming distribution of offset corrections.
Definition: pps-files.cpp:29
readPPSTimestamp
int readPPSTimestamp(pps_handle_t *handle, int *avail_mode, int *tm)
Definition: pps-files.cpp:2505
timeCheckParams::threadIsBusy
bool * threadIsBusy
True while thread is waiting for or processing a time query.
Definition: pps-client.h:157
writeFileMsgToLog
int writeFileMsgToLog(const char *filename)
Definition: pps-files.cpp:794
getRPiCPU
int getRPiCPU(void)
Definition: pps-files.cpp:1834
pps_msg_file
const char * pps_msg_file
Definition: pps-files.cpp:38
writeOffsets
void writeOffsets(const char *filename)
Definition: pps-files.cpp:1118
timeCheckParams::buf
char * buf
Space for the active NIST server list.
Definition: pps-client.h:153
jitter_distrib_file
const char * jitter_distrib_file
Stores a forming distribution of offset corrections.
Definition: pps-files.cpp:31
bufferStatusMsg
void bufferStatusMsg(const char *msg)
Definition: pps-files.cpp:407
arrayData_file
const char * arrayData_file
Stores a request sent to the PPS-Client daemon.
Definition: pps-files.cpp:37
G::noiseLevel
double noiseLevel
PPS time delay value beyond which a delay is defined to be a delay spike.
Definition: pps-client.h:198
G::interruptReceived
bool interruptReceived
Set "true" when makeTimeCorrection() processes an interrupt time from the Linux PPS device driver.
Definition: pps-client.h:183
createPIDfile
int createPIDfile(void)
Definition: pps-files.cpp:875
G::doSerialsettime
bool doSerialsettime
Definition: pps-client.h:242
FREQDIFF_INTRVL
#define FREQDIFF_INTRVL
The number of minutes between Allan deviation samples of system clock frequency correction.
Definition: pps-client.h:60
ppsIsRunning
bool ppsIsRunning(void)
Definition: pps-files.cpp:831
G::linuxVersion
char linuxVersion[20]
Array for recording the Linux version.
Definition: pps-client.h:246
last_jitter_distrib_file
const char * last_jitter_distrib_file
Stores the completed distribution of offset corrections.
Definition: pps-files.cpp:30
isDisabled
bool isDisabled(int key)
Definition: pps-files.cpp:289
NUM_5_MIN_INTERVALS
#define NUM_5_MIN_INTERVALS
Number of five minute intervals in 24 hours.
Definition: pps-client.h:53
G::slewAccum_cnt
int slewAccum_cnt
Count of the number of times G.rawError has been summed into G.slewAccum.
Definition: pps-client.h:212
getRootHome
int getRootHome(void)
Definition: pps-files.cpp:2545
LOGBUF_SZ
#define LOGBUF_SZ
Definition: pps-client.h:96
STRBUF_SZ
#define STRBUF_SZ
Definition: pps-client.h:95
G::t_mono_now
double t_mono_now
Current monotonic time.
Definition: pps-client.h:193
pps_handle_t
int pps_handle_t
Definition: timepps.h:60
G::cpuVersion
int cpuVersion
The principle CPU version number for Raspberry Pi processors else 0.
Definition: pps-client.h:170
G::t_now
int t_now
Rounded seconds of current time reported by gettimeofday().
Definition: pps-client.h:191
G::t3
struct timex t3
Passes G.timeCorrection to the system function adjtimex() in makeTimeCorrection().
Definition: pps-client.h:222
G::zeroOffset
int zeroOffset
Definition: pps-client.h:196
G::avgSlew
double avgSlew
Average slew value determined by getTimeSlew() from the average of G.slewAccum each time G....
Definition: pps-client.h:213
timeCheckParams::strbuf
char * strbuf
Space for messages and query strings.
Definition: pps-client.h:155
G::clockChanged
bool clockChanged
Set true if an external clock change is detected.
Definition: pps-client.h:209
getConfigs
int getConfigs(void)
Definition: pps-files.cpp:1356
G::minSustainedDelay
int minSustainedDelay
The observed minimum delay value of a sustained sequence of delay spikes.
Definition: pps-client.h:208
G::serialTimeUpdated
bool serialTimeUpdated
Definition: pps-client.h:243
SECS_PER_10_MIN
#define SECS_PER_10_MIN
Definition: pps-client.h:50
MSGBUF_SZ
#define MSGBUF_SZ
Definition: pps-client.h:97
G::nCores
int nCores
If PPS-Client is segregated, identifies the number of processor cores.
Definition: pps-client.h:168
nistTime_file
const char * nistTime_file
Definition: pps-files.cpp:41
setSyncDelay
struct timespec setSyncDelay(int timeAt, int fracSec)
Definition: pps-client.cpp:1086
G::avgCorrection
double avgCorrection
A one-minute rolling average of G.timeCorrection values generated by getMovingAverage().
Definition: pps-client.h:224
JITTER_DISTRIB_LEN
#define JITTER_DISTRIB_LEN
Definition: pps-client.h:103
open_logerr
int open_logerr(const char *filename, int flags, const char *location)
Definition: pps-files.cpp:486
integral_state_file
const char * integral_state_file
Definition: pps-files.cpp:42
log_file
const char * log_file
Stores activity and errors.
Definition: pps-files.cpp:32
bufferStateParams
int bufferStateParams(void)
Definition: pps-files.cpp:1693
timeCheckParams::ntp_server
char ** ntp_server
The active NIST server list when NIST is used.
Definition: pps-client.h:151
TERMhandler
void TERMhandler(int sig)
Definition: pps-files.cpp:2337
G::integralGain
double integralGain
Current controller integral gain.
Definition: pps-client.h:234
recordOffsets
void recordOffsets(int timeCorrection)
Definition: pps-files.cpp:2412
config_file
const char * config_file
The PPS-Client configuration file.
Definition: pps-files.cpp:27
timeCheckParams::gmtTime_file
char * gmtTime_file
Definition: pps-client.h:160
loadLastState
int loadLastState(void)
Definition: pps-files.cpp:610
G::configWasRead
bool configWasRead
True if pps-client.conf was read at least once.
Definition: pps-client.h:174
writeStatusStrings
int writeStatusStrings(void)
Definition: pps-files.cpp:435
buildErrorDistrib
void buildErrorDistrib(int timeCorrection)
Definition: pps-files.cpp:2294
G::interruptLost
bool interruptLost
Set "true" when a PPS interrupt time fails to be received.
Definition: pps-client.h:184
assert_file
const char * assert_file
The timestamps of the time corrections each second.
Definition: pps-files.cpp:35
G::tm
int tm[6]
Returns the timestamp from the Linux PPS device driver as a pair of ints.
Definition: pps-client.h:189
writeToLogNoTimestamp
void writeToLogNoTimestamp(char *logbuf)
Definition: pps-files.cpp:332
timeCheckParams::nistTime_file
char * nistTime_file
Definition: pps-client.h:161
pidFilename
const char * pidFilename
Stores the PID of PPS-Client.
Definition: pps-files.cpp:34
G::isDelaySpike
bool isDelaySpike
Set "true" by detectDelaySpike() when G.rawError exceeds G.noiseLevel.
Definition: pps-client.h:207
allocInitializeSerialThread
int allocInitializeSerialThread(timeCheckParams *tcp)
Definition: pps-serial.cpp:417
CONFIG_FILE_SZ
#define CONFIG_FILE_SZ
Definition: pps-client.h:99
G::ppsTimestamp
int ppsTimestamp
Fractional second value of the PPS timestamp from the kernel driver.
Definition: pps-client.h:178
G
Struct for program-wide global variables showing those important to the controller.
Definition: pps-client.h:167
INTRPT_DISTRIB_LEN
#define INTRPT_DISTRIB_LEN
Definition: pps-client.h:104
old_log_file
const char * old_log_file
Stores activity and errors.
Definition: pps-files.cpp:33
last_distrib_file
const char * last_distrib_file
Stores the completed distribution of offset corrections.
Definition: pps-files.cpp:28
showStatusEachSecond
void showStatusEachSecond(void)
Definition: pps-files.cpp:2004
timeCheckParams::rv
int rv
Definition: pps-client.h:158
G::rawError
int rawError
Signed difference: G.ppsTimestamp - G.zeroOffset in makeTimeCorrection().
Definition: pps-client.h:201
G::avgIntegral
double avgIntegral
One-minute average of the integrals in G.integral[].
Definition: pps-client.h:230
G::isControlling
bool isControlling
Set "true" by getAcquireState() when the control loop can begin to control the system clock frequency...
Definition: pps-client.h:180
G::correctionFifo
int correctionFifo[OFFSETFIFO_LEN]
Contains the G.timeCorrection values from over the previous 60 seconds.
Definition: pps-client.h:225
G::t
struct timeval t
Time of system response to the PPS interrupt received from the Linux PPS device driver.
Definition: pps-client.h:187
saveLastState
int saveLastState(void)
Definition: pps-files.cpp:509
home_file
const char * home_file
Definition: pps-files.cpp:43
timeCheckParams::serverTimeDiff
int * serverTimeDiff
Time difference between local time and server time.
Definition: pps-client.h:150
G::serialTimeError
int serialTimeError
Error reported by GPS serial port.S.
Definition: pps-client.h:244
G::nistTimeUpdated
bool nistTimeUpdated
Definition: pps-client.h:239
G::isVerbose
bool isVerbose
Enables continuous printing of PPS-Client status params when "true".
Definition: pps-client.h:172
linuxVersion_file
const char * linuxVersion_file
Definition: pps-files.cpp:39
G::useCore
int useCore
If PPS-Client is segregated, the core on which it runs.
Definition: pps-client.h:169