/* ================================================== */
+static void
+do_size_checks(void)
+{
+ /* Assertions to check the sizes of certain data types
+ and the positions of certain record fields */
+
+ /* Check that certain invariants are true */
+ assert(sizeof(NTP_int32) == 4);
+ assert(sizeof(NTP_int64) == 8);
+
+ /* Check offsets of all fields in the NTP packet format */
+ assert(offsetof(NTP_Packet, lvm) == 0);
+ assert(offsetof(NTP_Packet, stratum) == 1);
+ assert(offsetof(NTP_Packet, poll) == 2);
+ assert(offsetof(NTP_Packet, precision) == 3);
+ assert(offsetof(NTP_Packet, root_delay) == 4);
+ assert(offsetof(NTP_Packet, root_dispersion) == 8);
+ assert(offsetof(NTP_Packet, reference_id) == 12);
+ assert(offsetof(NTP_Packet, reference_ts) == 16);
+ assert(offsetof(NTP_Packet, originate_ts) == 24);
+ assert(offsetof(NTP_Packet, receive_ts) == 32);
+ assert(offsetof(NTP_Packet, transmit_ts) == 40);
+}
+
+/* ================================================== */
+
void
NCR_Initialise(void)
{
+ do_size_checks();
+
logfileid = CNF_GetLogMeasurements() ? LOG_FileOpen("measurements",
" Date (UTC) Time IP Address L St 1234 abc 5678 LP RP Score Offset Peer del. Peer disp. Root del. Root disp.")
: -1;
/* ================================================== */
-static void
-do_size_checks(void)
-{
- /* Assertions to check the sizes of certain data types
- and the positions of certain record fields */
-
- /* Check that certain invariants are true */
- assert(sizeof(NTP_int32) == 4);
- assert(sizeof(NTP_int64) == 8);
-
- /* Check offsets of all fields in the NTP packet format */
- assert(offsetof(NTP_Packet, lvm) == 0);
- assert(offsetof(NTP_Packet, stratum) == 1);
- assert(offsetof(NTP_Packet, poll) == 2);
- assert(offsetof(NTP_Packet, precision) == 3);
- assert(offsetof(NTP_Packet, root_delay) == 4);
- assert(offsetof(NTP_Packet, root_dispersion) == 8);
- assert(offsetof(NTP_Packet, reference_id) == 12);
- assert(offsetof(NTP_Packet, reference_ts) == 16);
- assert(offsetof(NTP_Packet, originate_ts) == 24);
- assert(offsetof(NTP_Packet, receive_ts) == 32);
- assert(offsetof(NTP_Packet, transmit_ts) == 40);
-
-}
-
-/* ================================================== */
-
static int
prepare_socket(int family, int port_number, int client_only)
{
assert(!initialised);
initialised = 1;
- do_size_checks();
-
server_port = CNF_GetNTPPort();
client_port = CNF_GetAcquisitionPort();