@@ -8,6 +8,7 @@
#include "display.h"
#include "displayHandler.h"
+#include "ntp.h"
#include "rtc.h"
#define MONTH_OFFSET 1
@@ -34,6 +35,8 @@ void displayDate(int line_number){
char str[13];
sprintf(str, " %02d-%02d-%04d", time->tm_mday, time->tm_mon+MONTH_OFFSET, time->tm_year+YEAR_OFFSET);
+ if(NtpIsSyncing())
+ str[1] = 'S';
if (line_number > -1 && line_number < 2){
(*write_display_ptr[line_number])(str, 13);
}
@@ -23,6 +23,7 @@
#define TIME_ZONE 1
#define LOG_MODULE LOG_NTP_MODULE
+bool isSyncing;
time_t ntp_time = 0;
tm *ntp_datetime;
uint32_t timeserver = 0;
@@ -33,8 +34,13 @@ void NtpInit() {
GetTime();
+bool NtpIsSyncing(){
+ return isSyncing;
+}
+
void GetTime(){
/* Ophalen van pool.ntp.org */
+ isSyncing = true;
puts("Tijd ophalen van pool.ntp.org (213.154.229.24)");
timeserver = inet_addr("213.154.229.24");
@@ -55,5 +61,5 @@ void GetTime(){
X12RtcSetClock(ntp_datetime);
-
+ isSyncing = false;
@@ -5,6 +5,9 @@
#ifndef _Network_H
#define _Network_H
+typedef enum {false, true} bool;
+extern bool NtpIsSyncing(void);
extern void NtpInit(void);
extern void GetTime(void);
#endif /* _Network_H */