- support to compile SNTP client code with MSVC (LIB61850-360)

v1.6_develop_rgoose_sntp
Michael Zillgith 3 years ago
parent 6a1079ceb3
commit 6f2bb1a19c

@ -25,6 +25,10 @@
#include "libiec61850_common_api.h"
#include "hal_socket.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct sSNTPClient* SNTPClient;
typedef void (*SNTPClient_UserCallback)(void* parameter, bool isSynced);
@ -62,4 +66,8 @@ SNTPClient_stop(SNTPClient self);
LIB61850_API void
SNTPClient_destroy(SNTPClient self);
#ifdef __cplusplus
}
#endif
#endif /* LIBIEC61850_SRC_COMMON_INC_SNTP_CLIENT_H_ */

@ -1,5 +1,5 @@
/*
* Copyright 2013-2020 Michael Zillgith
* Copyright 2013-2022 Michael Zillgith
*
* This file is part of libIEC61850.
*
@ -94,7 +94,7 @@ ntpTimeToNsTime(uint32_t coarse, uint32_t fine)
static void
nsTimeToNtpTime(nsSinceEpoch nsTime, uint32_t* coarse, uint32_t* fine)
{
uint32_t secondsPart = (nsTime / 1000000000UL) + UNIX_EPOCH_OFFSET;
uint32_t secondsPart = (uint32_t)((nsTime / 1000000000UL) + UNIX_EPOCH_OFFSET);
*coarse = secondsPart;
@ -108,7 +108,7 @@ nsTimeToNtpTime(nsSinceEpoch nsTime, uint32_t* coarse, uint32_t* fine)
static uint32_t
nsTimeToSeconds(nsSinceEpoch nsTime)
{
uint32_t secondsSinceEpoch = nsTime / 1000000000UL;
uint32_t secondsSinceEpoch = (uint32_t)(nsTime / 1000000000UL);
return secondsSinceEpoch;
}
@ -118,7 +118,7 @@ getUsPartFromNsTime(nsSinceEpoch nsTime)
{
uint64_t nsPart = nsTime % 1000000000UL;
uint32_t msPart = nsPart / 1000UL;
uint32_t msPart = (uint32_t)(nsPart / 1000UL);
return msPart;
}

Loading…
Cancel
Save