Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface NTPClient mbed-rtos mbed
Fork of ptgm_semDMA by
Codes/ntpc.cpp
- Committer:
- viniciushl
- Date:
- 2016-01-13
- Revision:
- 1:8129536051df
- Parent:
- 0:fac116e94d44
File content as of revision 1:8129536051df:
#include "ntpc.h"
void ntpc::ntpc_Thread(void const* arg)
{
printf("\r\nTrhead NTP client\r\n");
while (true)
{
ntpcDo();
wait(30);
}
}
void ntpc::ntpcDo()
{
printf("Pegando NTP...\r\n");
if (ntpClient.setTime("ntp.ubuntu.com") == 0) {
printf("NTP OK!\r\n");
time_t ctTime;
ctTime = time(NULL);
printf("Setando para hora (UTC): %s\r\n", ctime(&ctTime));
} else {
printf("NTP Erro!\r\n");
}
}
