for myself
Dependencies: EthernetInterface NTPClient mbed-rtos mbed
Fork of NTPClient_HelloWorld by
Diff: main.cpp
- Revision:
- 3:4ed90aeba03a
- Parent:
- 2:bf7dc5f5bca9
diff -r bf7dc5f5bca9 -r 4ed90aeba03a main.cpp --- a/main.cpp Sun Aug 05 16:17:31 2012 +0000 +++ b/main.cpp Tue Nov 10 06:11:12 2015 +0000 @@ -12,12 +12,19 @@ eth.connect(); printf("Trying to update time...\r\n"); - if (ntp.setTime("0.pool.ntp.org") == 0) + if (ntp.setTime("ntp.jst.mfeed.ad.jp") == 0) { printf("Set time successfully\r\n"); time_t ctTime; ctTime = time(NULL); - printf("Time is set to (UTC): %s\r\n", ctime(&ctTime)); + ctTime += 32400; + printf("Time is set to (JPN): %s\r\n", ctime(&ctTime)); + while(1){ + wait(10); + ctTime = time(NULL); + ctTime += 32400; + printf("Time is set to (JPN): %s\r\n", ctime(&ctTime)); + } } else {