diff --git a/Packet++/src/NtpLayer.cpp b/Packet++/src/NtpLayer.cpp index 81e399a17..4da03d9ad 100644 --- a/Packet++/src/NtpLayer.cpp +++ b/Packet++/src/NtpLayer.cpp @@ -598,12 +598,13 @@ namespace pcpp double const fractionPart = modf(timestamp, &integerPart); struct tm* timer = nullptr; - time_t const timeStruct = integerPart; #if defined(_WIN32) + time_t timeStruct = integerPart; if (timeStruct < 0) timeStruct = 0; timer = gmtime(&timeStruct); #else + time_t const timeStruct = integerPart; struct tm timer_r{}; timer = gmtime_r(&timeStruct, &timer_r);