Andrew Reed
/
NTP-Demo+Sensor
NTP demo for cypress Pioneer and Proto Dev kits also reads available analogue sensors
Diff: main.cpp
- Revision:
- 2:a92d7ea0f3e3
- Parent:
- 1:352a27b3a1ec
- Child:
- 3:9d9e29b54a1a
--- a/main.cpp Wed Jul 01 16:13:35 2020 +0100 +++ b/main.cpp Wed Jul 01 16:21:41 2020 +0100 @@ -100,7 +100,7 @@ //rawtime = rawtime - (4*60*60); // UTC - 4hours ... serious hack which only works in summer rawtime = rawtime + 3600; // GMT + 1 for BST timeinfo = localtime (&rawtime); - strftime (buffer,sizeof(buffer)," %r ",timeinfo); + strftime (buffer,sizeof(buffer)," %r ", timeinfo); GUI_SetFont(GUI_FONT_32B_1); GUI_DispStringHCenterAt(buffer,LCD_GetXSize()/2,LCD_GetYSize()/2 - GUI_GetFontSizeY()/2 - 20); printf("%s\r\n", buffer); @@ -190,10 +190,10 @@ displayQueue->call(updateDisplayNTPFailed); } else { set_time(timestamp); + old_timestamp = timestamp; displayQueue->call(updateDisplayNTPCount); } } - old_timestamp = timestamp; ThisThread::sleep_for(300s); // Goto the NTP server every 5 minutes } }