ntp: change ip to time.windows.com, apparently not blocked in China

This commit is contained in:
TuxSH 2020-04-18 00:29:37 +01:00
parent 67e28b2a82
commit 5c16836626
2 changed files with 9 additions and 7 deletions

View File

@ -34,8 +34,10 @@
#define NTP_TIMESTAMP_DELTA 2208988800ull #define NTP_TIMESTAMP_DELTA 2208988800ull
#define MAKE_IPV4(a,b,c,d) ((a) << 24 | (b) << 16 | (c) << 8 | (d))
#ifndef NTP_IP #ifndef NTP_IP
#define NTP_IP 0xD8EF2300 #define NTP_IP MAKE_IPV4(51, 137, 137, 111) // time.windows.com
#endif #endif
typedef struct RtcTime { typedef struct RtcTime {
@ -113,7 +115,7 @@ Result ntpGetTimeStamp(time_t *outTimestamp)
// Copy the server's IP address to the server address structure. // Copy the server's IP address to the server address structure.
servAddr.sin_addr.s_addr = htonl(NTP_IP); // 216.239.35.0 time1.google.com servAddr.sin_addr.s_addr = htonl(NTP_IP);
// Convert the port number integer to network big-endian style and save it to the server address structure. // Convert the port number integer to network big-endian style and save it to the server address structure.
servAddr.sin_port = htons(123); servAddr.sin_port = htons(123);