10 #include <sys/types.h>
17 #define MAXTTABLE 10000
20 static int32_t nTab = 0;
23 int retval = strcmp(rec1->time1, rec2->time1);
26 retval = (
int) rec1->type - rec2->type;
40 printf(
"-W- %s: TEMPORAL_ANOMALY env variable undefined.\n", __FILE__);
46 "-W- %s line %d: unable to open %s for reading\n",
53 status = fscanf(fp,
"%16s %6d %16s %6d %6d\n",
54 timeTable[nTab].time1,
55 &timeTable[nTab].
type,
56 timeTable[nTab].time2,
58 &timeTable[nTab].delmsec);
70 fprintf(fp,
"%16s %6d %16s %6d %6d\n",
89 "-E- %s line %d: unable to open %s for writing\n",
104 INT32 srec = indx->srec;
105 INT32 erec = indx->erec;
106 INT32 irec = srec - 1;
117 if (updfile ==
NULL || indx->type !=
GAC)
121 if ((fp = fopen(updfile,
"w")) ==
NULL) {
123 "-E- %s line %d: unable to open %s for writing\n",
124 __FILE__, __LINE__, updfile);
129 while (irec < erec - 10) {
133 if (indx->rec[irec].mnftype !=
GACTYPE)
140 for (i2 = irec + 8; i2 <= irec + 10; i2++) {
142 if (indx->rec[i1].tShfError && indx->rec[i2].tShfError &&
144 fabs(indx->rec[i1].timeShift + indx->rec[i2].timeShift) < 2 *
CLOCKVAR) {
146 delsec = indx->rec[i1].timeShift;
147 delmsec = (int32_t) (delsec * 1000);
149 printf(
"Correctable timeshift located at frame %d of %d msecs\n",
155 timeTable[nTab].delmsec = delmsec;
156 timeTable[nTab].type =
GACTYPE;
157 timeTable[nTab].action = 1;
161 "-E- %s line %d: temporal anomaly table size exceeded: %d\n",
162 __FILE__, __LINE__, nTab);
171 timeTable[nTab].delmsec = (int32_t) 0;
172 timeTable[nTab].type =
LACTYPE;
173 timeTable[nTab].action = 2;
177 "-E- %s line %d: temporal anomaly table size exceeded: %d\n",
178 __FILE__, __LINE__, nTab);
187 timeTable[nTab].delmsec = delmsec;
188 timeTable[nTab].type =
LACTYPE;
189 timeTable[nTab].action = 1;
193 "-E- %s line %d: temporal anomaly table size exceeded: %d\n",
194 __FILE__, __LINE__, nTab);
202 timeTable[nTab].delmsec = (int32_t) 0;
203 timeTable[nTab].type =
LACTYPE;
204 timeTable[nTab].action = 2;
208 "-E- %s line %d: temporal anomaly table size exceeded: %d\n",
209 __FILE__, __LINE__, nTab);
226 qsort(timeTable, nTab,
sizeof (timeTab),
232 for (i1 = 1; i1 < nTab; i1++)
233 if (strcmp(timeTable[i1].time1, timeTable[i1 - 1].time1) != 0 ||
234 timeTable[i1].
type != timeTable[i1 - 1].
type) {
240 for (i1 = 1; i1 < nTab; i1++)
242 memcpy(&timeTable[i1], &timeTable[uniq[i1]],
sizeof (timeTab));
249 if (fp !=
NULL) fclose(fp);
255 timeTab *trec =
NULL;
264 if (timeTable[
itab].
type != mnftype)
267 if (strcmp(ztime, timeTable[
itab].time2) < 0) {
268 if (strcmp(ztime, timeTable[
itab].time1) >= 0) {
269 trec = &timeTable[
itab];