summaryrefslogtreecommitdiff
path: root/Userland/Utilities/ntpquery.cpp
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-04-01 20:58:27 +0300
committerLinus Groh <mail@linusgroh.de>2022-04-01 21:24:45 +0100
commit086969277e74d8ba065bf8145d3aeb0dec0bfee5 (patch)
tree02b3699a66735ef806d9b46353491f18f8e4e7b4 /Userland/Utilities/ntpquery.cpp
parent0376c127f6e98e03607700d0b3f5154b7014b2f8 (diff)
downloadserenity-086969277e74d8ba065bf8145d3aeb0dec0bfee5.zip
Everywhere: Run clang-format
Diffstat (limited to 'Userland/Utilities/ntpquery.cpp')
-rw-r--r--Userland/Utilities/ntpquery.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Utilities/ntpquery.cpp b/Userland/Utilities/ntpquery.cpp
index 26dce2a1a2..c02e0187f6 100644
--- a/Userland/Utilities/ntpquery.cpp
+++ b/Userland/Utilities/ntpquery.cpp
@@ -53,9 +53,9 @@ static_assert(AssertSize<NtpPacket, 48>());
// NTP measures time in seconds since 1900-01-01, POSIX in seconds since 1970-01-01.
// 1900 wasn't a leap year, so there are 70/4 leap years between 1900 and 1970.
// Overflows a 32-bit signed int, but not a 32-bit unsigned int.
-const unsigned SecondsFrom1900To1970 = (70u * 365u + 70u / 4u) * 24u * 60u * 60u;
+unsigned const SecondsFrom1900To1970 = (70u * 365u + 70u / 4u) * 24u * 60u * 60u;
-static NtpTimestamp ntp_timestamp_from_timeval(const timeval& t)
+static NtpTimestamp ntp_timestamp_from_timeval(timeval const& t)
{
VERIFY(t.tv_usec >= 0 && t.tv_usec < 1'000'000); // Fits in 20 bits when normalized.
@@ -68,7 +68,7 @@ static NtpTimestamp ntp_timestamp_from_timeval(const timeval& t)
return (static_cast<NtpTimestamp>(seconds) << 32) | fractional_bits;
}
-static timeval timeval_from_ntp_timestamp(const NtpTimestamp& ntp_timestamp)
+static timeval timeval_from_ntp_timestamp(NtpTimestamp const& ntp_timestamp)
{
timeval t;
t.tv_sec = static_cast<time_t>(ntp_timestamp >> 32) - SecondsFrom1900To1970;
@@ -113,7 +113,7 @@ int main(int argc, char** argv)
// Leap seconds smearing NTP servers:
// - time.facebook.com , https://engineering.fb.com/production-engineering/ntp-service/ , sine-smears over 18 hours
// - time.google.com , https://developers.google.com/time/smear , linear-smears over 24 hours
- const char* host = "time.google.com";
+ char const* host = "time.google.com";
Core::ArgsParser args_parser;
args_parser.add_option(adjust_time, "Gradually adjust system time (requires root)", "adjust", 'a');
args_parser.add_option(set_time, "Immediately set system time (requires root)", "set", 's');
@@ -171,7 +171,7 @@ int main(int argc, char** argv)
memset(&peer_address, 0, sizeof(peer_address));
peer_address.sin_family = AF_INET;
peer_address.sin_port = htons(123);
- peer_address.sin_addr.s_addr = *(const in_addr_t*)hostent->h_addr_list[0];
+ peer_address.sin_addr.s_addr = *(in_addr_t const*)hostent->h_addr_list[0];
NtpPacket packet;
memset(&packet, 0, sizeof(packet));