Skip to content

Commit

Permalink
cavern: Treat date 1901-01-01 in Compass dat as omitted
Browse files Browse the repository at this point in the history
This is the date Compass uses when no date was specified, and seems
very unlikely to occur in real data.
  • Loading branch information
ojwb committed Feb 14, 2024
1 parent aed46d9 commit 54a7e33
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/datain.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,8 +704,11 @@ data_file(const char *pth, const char *fnm)
/* Note: Larry says a 2 digit year is always 19XX */
if (year < 100) year += 1900;

/* Compass uses 1901-01-01 when no date was specified. */
if (year == 1901 && day == 1 && month == 1) goto compass_dat_no_date;
pcs->meta->days1 = pcs->meta->days2 = days_since_1900(year, month, day);
} else {
compass_dat_no_date:
pcs->meta->days1 = pcs->meta->days2 = -1;
}
pcs->declination = HUGE_REAL;
Expand Down
2 changes: 1 addition & 1 deletion tests/backread.dat
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DECLINATION: 0 FORMAT: DDDDLRUDLADB CORRECTIONS: 0.00 0.00 0.00

Cave
SURVEY NAME: D
SURVEY DATE: 10 14 1986 COMMENT:Test newer format backsights
SURVEY DATE: 1 1 1 COMMENT:Test newer format backsights
SURVEY TEAM:
Us, Them
DECLINATION: 0 FORMAT: DDDWLRUDLADadBF CORRECTIONS: 0.00 0.00 0.00 CORRECTIONS2: 1.0 -1.0
Expand Down
2 changes: 1 addition & 1 deletion tests/backread.dump
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VERSION 8
SEPARATOR '.'
--
LEG 0.00 0.00 0.00 0.00 1.00 0.00 [] STYLE=NORMAL 1986.10.13
LEG 0.00 1.00 0.00 0.59 2.15 0.52 [] STYLE=DIVING 1986.10.14
LEG 0.00 1.00 0.00 0.59 2.15 0.52 [] STYLE=DIVING
NODE 0.59 2.15 0.52 [D1] UNDERGROUND
NODE 0.00 1.00 0.00 [C2] UNDERGROUND
NODE 0.00 0.00 0.00 [C1] UNDERGROUND
Expand Down

0 comments on commit 54a7e33

Please sign in to comment.