Skip to content

Commit c936b6d

Browse files
authored
sntp: Build fix
Add log levels in order to fix build errors.
1 parent 799527a commit c936b6d

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Includes/sntpClient.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,23 @@ void sntpClient::updateTime() const {
5858
socklen_t saddr_len = sizeof(saddr);
5959
int sent = sendto(s, &message, sizeof(message), 0, (struct sockaddr*)&saddr, saddr_len);
6060
if (sent != sizeof(message)) {
61-
InfoLog::outputLine("SNTP: Failed to send request message\n");
61+
InfoLog::outputLine(InfoLog::INFO, "SNTP: Failed to send request message\n");
6262
close(s);
6363
return;
6464
}
6565

6666
int received = recvfrom(s, &message, sizeof(message), 0, &saddr, &saddr_len);
6767
close(s);
6868
if (received != sizeof(message)) {
69-
InfoLog::outputLine("SNTP: Failed to receive response: %d\n", received);
69+
InfoLog::outputLine(InfoLog::INFO, "SNTP: Failed to receive response: %d\n", received);
7070
return;
7171
}
7272

7373
message.originTimestamp.seconds = htonl(message.originTimestamp.seconds);
7474
message.originTimestamp.fractionalSeconds =
7575
htonl(message.originTimestamp.fractionalSeconds);
7676
if (message.originTimestamp.seconds || message.originTimestamp.fractionalSeconds) {
77-
InfoLog::outputLine("SNTP: Origin epoch is not 0: %lld\n", message.originTimestamp);
77+
InfoLog::outputLine(InfoLog::INFO, "SNTP: Origin epoch is not 0: %lld\n", message.originTimestamp);
7878
}
7979

8080
message.transmitTimestamp.seconds = htonl(message.transmitTimestamp.seconds);
@@ -95,10 +95,10 @@ void sntpClient::updateTime() const {
9595
}
9696

9797
if (delta > allowedDriftSeconds) {
98-
InfoLog::outputLine("SNTP: Updating system clock (%llu seconds of drift)\n", delta);
98+
InfoLog::outputLine(InfoLog::DEBUG, "SNTP: Updating system clock (%llu seconds of drift)\n", delta);
9999
NTSTATUS status = NtSetSystemTime(&serverTime, nullptr);
100100
if (!NT_SUCCESS(status)) {
101-
InfoLog::outputLine("SNTP: NtSetSystemTime failed: %X\n", status);
101+
InfoLog::outputLine(InfoLog::INFO, "SNTP: NtSetSystemTime failed: %X\n", status);
102102
}
103103
}
104104

@@ -108,7 +108,7 @@ void sntpClient::updateTime() const {
108108
#ifdef NXDK
109109
static int sntpConnect(std::string const& sntpHost, uint32_t port, struct sockaddr& saddr) {
110110
if (port > 0xFFFF) {
111-
InfoLog::outputLine("SNTP: invalid port: %d\n", port);
111+
InfoLog::outputLine(InfoLog::WARNING, "SNTP: invalid port: %d\n", port);
112112
return -1;
113113
}
114114

@@ -124,14 +124,14 @@ static int sntpConnect(std::string const& sntpHost, uint32_t port, struct sockad
124124
struct addrinfo* ai;
125125
int status = getaddrinfo(sntpHost.c_str(), portString, &hints, &ai);
126126
if (status) {
127-
InfoLog::outputLine("SNTP: getaddrinfo failed: %d\n", status);
127+
InfoLog::outputLine(InfoLog::INFO, "SNTP: getaddrinfo failed: %d\n", status);
128128
return -1;
129129
}
130130

131131
int ret;
132132
ret = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
133133
if (ret < 0) {
134-
InfoLog::outputLine("SNTP: Failed to create socket: %d\n", errno);
134+
InfoLog::outputLine(InfoLog::INFO, "SNTP: Failed to create socket: %d\n", errno);
135135
freeaddrinfo(ai);
136136
return ret;
137137
}

0 commit comments

Comments
 (0)