summaryrefslogtreecommitdiff
path: root/Events.c
diff options
context:
space:
mode:
authorDave Hibberd <hibby@debian.org>2026-03-08 02:27:19 +0000
committerDave Hibberd <hibby@debian.org>2026-03-08 02:27:19 +0000
commit90bbe9abf9996c82667d3e4f58b4e3db77129e48 (patch)
treea3c1d7b3c884e3f3182db11968e94a8eb538e3f9 /Events.c
parent4f0df4999cd0f9e425a93dc08080b4084634c450 (diff)
parent7aa6cec9300c8a3e9ef98b19791ad324d487512e (diff)
Update upstream source from tag 'upstream/6.0.25.33+repack'
Update to upstream version '6.0.25.33+repack' with Debian dir 8c0c36c05c355f6cb21140b2ebd58907087b1423
Diffstat (limited to 'Events.c')
-rw-r--r--Events.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/Events.c b/Events.c
index 8e63cfe..1db1740 100644
--- a/Events.c
+++ b/Events.c
@@ -752,7 +752,13 @@ void APIL2Trace(struct _MESSAGE * Message, char * Dirn)
int NR;
struct PORTCONTROL * PORT = GetPortTableEntryFromPortNum(Message->PORT);
time_t Now = time(NULL);
-
+#ifdef LINBPQ
+ struct timespec ts;
+#else
+ FILETIME SystemTimeAsFileTime;
+ ULARGE_INTEGER FT64;
+#endif
+ double NowMs;
if (PORT == 0)
return;
@@ -776,6 +782,20 @@ void APIL2Trace(struct _MESSAGE * Message, char * Dirn)
if ((Message->ORIGIN[6] & 1) == 0) // Digis - ignore for now
return;
+#ifdef LINBPQ
+
+ if (clock_gettime(CLOCK_REALTIME, &ts) == -1)
+ NowMs = Now;
+ else
+ NowMs = ts.tv_sec + ts.tv_nsec / 1000000000.0;
+#else
+ GetSystemTimeAsFileTime(&SystemTimeAsFileTime);
+ // FILETIME is 100 nS interval since 1601 - subtract 116444736000000000 to get 100 nS intervels since 1970 (Unix Time)
+ FT64.HighPart = SystemTimeAsFileTime.dwHighDateTime;
+ FT64.LowPart = SystemTimeAsFileTime.dwLowDateTime;
+ NowMs = (FT64.QuadPart - 116444736000000000) / 10000000.0;
+#endif
+
if ((Message->DEST[6] & 0x80) == 0 && (Message->ORIGIN[6] & 0x80) == 0)
strcpy(CR, "V1");
else if ((Message->DEST[6] & 0x80))
@@ -898,9 +918,9 @@ void APIL2Trace(struct _MESSAGE * Message, char * Dirn)
// Common to all frame types
udplen = snprintf(UDPMsg, 2048,
- "{\"@type\": \"L2Trace\", \"serial\": %d, \"time\": %d, \"dirn\": \"%s\", \"isRF\": %s, \"reportFrom\": \"%s\", \"port\": \"%d\", \"srce\": \"%s\", \"dest\": \"%s\", \"ctrl\": %d,"
+ "{\"@type\": \"L2Trace\", \"serial\": %d, \"time\": %.3f, \"dirn\": \"%s\", \"isRF\": %s, \"reportFrom\": \"%s\", \"port\": \"%d\", \"srce\": \"%s\", \"dest\": \"%s\", \"ctrl\": %d,"
"\"l2Type\": \"%s\", \"modulo\": 8, \"cr\": \"%s\"",
- UDPSeq++, (int)Now, Dirn, (PORT->isRF)?"true":"false", NODECALLLOPPED, Message->PORT, srcecall, destcall, Message->CTL, Type, CR);
+ UDPSeq++, NowMs, Dirn, (PORT->isRF)?"true":"false", NODECALLLOPPED, Message->PORT, srcecall, destcall, Message->CTL, Type, CR);
if (UIFlag)
{
@@ -949,12 +969,10 @@ void APIL2Trace(struct _MESSAGE * Message, char * Dirn)
udplen += snprintf(&UDPMsg[udplen], 2048 - udplen, ", \"rseq\": %d", NR);
}
-
UDPMsg[udplen++] = '}';
UDPMsg[udplen] = 0;
-// Debugprintf(UDPMsg);
+ Debugprintf(UDPMsg);
sendto(NodeAPISocket, UDPMsg, udplen, 0, (struct sockaddr *)&UDPreportdest, sizeof(UDPreportdest));
-
}