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

@ -352,8 +352,8 @@ void MiscellaneousMenu_SyncTimeDate(void)
if(input & BUTTON_LEFT) utcOffset = (24 + utcOffset - 1) % 24; // ensure utcOffset >= 0
if(input & BUTTON_RIGHT) utcOffset = (utcOffset + 1) % 24;
if(input & BUTTON_UP) utcOffsetMinute = (utcOffsetMinute + 1) % 60;
if(input & BUTTON_DOWN) utcOffsetMinute = (60 + utcOffsetMinute - 1) % 60;
if(input & BUTTON_UP) utcOffsetMinute = (utcOffsetMinute + 1) % 60;
if(input & BUTTON_DOWN) utcOffsetMinute = (60 + utcOffsetMinute - 1) % 60;
Draw_FlushFramebuffer();
Draw_Unlock();
}
@ -373,7 +373,7 @@ void MiscellaneousMenu_SyncTimeDate(void)
if(R_SUCCEEDED(res))
{
t += 3600 * utcOffset;
t += 60 * utcOffsetMinute;
t += 60 * utcOffsetMinute;
gmtime_r(&t, &localt);
res = ntpSetTimeDate(&localt);
}

View File

@ -30,12 +30,14 @@
#include "utils.h"
#include "minisoc.h"
#define NUM2BCD(n) ((n<99) ? (((n/10)*0x10)|(n%10)) : 0x99)
#define NUM2BCD(n) ((n<99) ? (((n/10)*0x10)|(n%10)) : 0x99)
#define NTP_TIMESTAMP_DELTA 2208988800ull
#define MAKE_IPV4(a,b,c,d) ((a) << 24 | (b) << 16 | (c) << 8 | (d))
#ifndef NTP_IP
#define NTP_IP 0xD8EF2300
#define NTP_IP MAKE_IPV4(51, 137, 137, 111) // time.windows.com
#endif
typedef struct RtcTime {
@ -113,7 +115,7 @@ Result ntpGetTimeStamp(time_t *outTimestamp)
// 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.
servAddr.sin_port = htons(123);