Skip to content

Commit

Permalink
changes TEST=wiring/networking to not be dependent on hardcoded ip ad…
Browse files Browse the repository at this point in the history
…dress
  • Loading branch information
technobly committed Mar 21, 2018
1 parent 5b93f3a commit db63d76
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions user/tests/wiring/networking/udp_ntp_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@

unsigned int localPort = 8888; // local port to listen for UDP packets

IPAddress timeServer(132, 163, 4, 101); // time-a.timefreq.bldrdoc.gov NTP server
// IPAddress timeServer(132, 163, 4, 102); // time-b.timefreq.bldrdoc.gov NTP server
// IPAddress timeServer(132, 163, 4, 103); // time-c.timefreq.bldrdoc.gov NTP server
IPAddress timeServer;
// time-a.timefreq.bldrdoc.gov NTP server
// time-b.timefreq.bldrdoc.gov NTP server
// time-c.timefreq.bldrdoc.gov NTP server

const int NTP_PACKET_SIZE= 48; // NTP time stamp is in the first 48 bytes of the message

Expand Down Expand Up @@ -78,6 +79,12 @@ unsigned long getNTPClientTime(void)

uint32_t _millis = millis();

#if Wiring_WiFi
timeServer = WiFi.resolve("time-a.timefreq.bldrdoc.gov");
#elif Wiring_Cellular
timeServer = Cellular.resolve("time-a.timefreq.bldrdoc.gov");
#endif

// timeout after 10 secs
while(millis() - _millis < 10000)
{
Expand Down

0 comments on commit db63d76

Please sign in to comment.