Skip to content

Commit 04e652c

Browse files
committed
Fixed TIMEFIX only inserting 000000h
Turns out beacon.c:fix_beacon_time() was using the global timeval now struct to populate its zulu timestamp on beacons, but the global now variable was never set anywhere and not used by any other functions. The global now struct was removed and a local zulutime timeval is now used to populate timestamps.
1 parent 2ae4a08 commit 04e652c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

aprx.h

-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ extern const char *swname;
169169
extern const char *swversion;
170170

171171
extern void timetick(void);
172-
extern struct timeval now; // Public wall lock time that can jump around
173172
extern struct timeval tick; // Monotonic clock, progresses regularly from boot. NOT wall clock time.
174173
extern int time_reset; // Set during ONE call cycle of prepolls
175174
extern int debug;

beacon.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -690,8 +690,10 @@ static void fix_beacon_time(char *txt, int txtlen)
690690
{
691691
int hour, min, sec;
692692
char hms[8];
693+
struct timeval zulutime;
693694

694-
sec = now.tv_sec % (3600*24); // UNIX time is UTC -> no need to play with fancy timezone conversions and summer times...
695+
gettimeofday(&zulutime, NULL);
696+
sec = zulutime.tv_sec % (3600*24); // UNIX time is UTC -> no need to play with fancy timezone conversions and summer times...
695697
hour = sec / 3600;
696698
min = (sec / 60) % 60;
697699
sec = sec % 60;

0 commit comments

Comments
 (0)