Skip to content

Instantly share code, notes, and snippets.

@Ryanhu1015
Last active July 29, 2017 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ryanhu1015/fb14b3fa1b1820ea1ebac89c9be889d7 to your computer and use it in GitHub Desktop.
Save Ryanhu1015/fb14b3fa1b1820ea1ebac89c9be889d7 to your computer and use it in GitHub Desktop.
NTPserver_alternative
//there are three option
char *ntpServerName = "tick.stdtime.gov.tw";
char *ntpServerName2 = "clock.stdtime.gov.tw";
char *ntpServerName3 = "time.stdtime.gov.tw";
void setup()
{
//.skip this part
//.
//.
server.on("/NTP", []()
{
ntpServer(ntpServerName);
hours = ((epoch % 86400L) / 3600) + 8;
minutes = (epoch % 3600) / 60;
seconds = epoch % 60;
show();
server.send(1000, "text/html", page);
});
server.on("/NTP2", []()
{
ntpServer(ntpServerName2);
hours = ((epoch % 86400L) / 3600) + 8;
minutes = (epoch % 3600) / 60;
seconds = epoch % 60;
show();
server.send(1000, "text/html", page);
});
server.on("/NTP3", []()
{
ntpServer(ntpServerName3);
hours = ((epoch % 86400L) / 3600) + 8;
minutes = (epoch % 3600) / 60;
seconds = epoch % 60;
show();
server.send(1000, "text/html", page);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment