Add NTP_IP dynamic changes via -D or #define (#1261)

* Add define option on Makefile to change NTP_IP dynamically

* Remove Makefile -D option
This commit is contained in:
Chromaryu 2019-06-04 06:24:21 +09:00 committed by TuxSH
parent 2cf04e8a83
commit 648541bb1f

View File

@ -34,6 +34,10 @@
#define NTP_TIMESTAMP_DELTA 2208988800ull #define NTP_TIMESTAMP_DELTA 2208988800ull
#ifndef NTP_IP
#define NTP_IP 0xD8EF2300
#endif
typedef struct RtcTime { typedef struct RtcTime {
// From 3dbrew // From 3dbrew
u8 seconds; u8 seconds;
@ -109,7 +113,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(0xD8EF2300); // 216.239.35.0 time1.google.com servAddr.sin_addr.s_addr = htonl(NTP_IP); // 216.239.35.0 time1.google.com
// 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);
@ -189,4 +193,4 @@ Result ntpSetTimeDate(const struct tm *localt)
mcuHwcExit(); mcuHwcExit();
cfguExit(); cfguExit();
return res; return res;
} }