|
@@ -19,13 +19,15 @@
|
|
|
|
|
|
|
|
#include "ntp.h"
|
|
#include "ntp.h"
|
|
|
|
|
|
|
|
|
|
+#define TIME_ZONE 0
|
|
|
|
|
+
|
|
|
time_t ntp_time = 0;
|
|
time_t ntp_time = 0;
|
|
|
tm *ntp_datetime;
|
|
tm *ntp_datetime;
|
|
|
uint32_t timeserver = 0;
|
|
uint32_t timeserver = 0;
|
|
|
|
|
|
|
|
void NtpInit() {
|
|
void NtpInit() {
|
|
|
/* Timezone van nederland (gmt 1) */
|
|
/* Timezone van nederland (gmt 1) */
|
|
|
- _timezone = -2 * 60 * 60;
|
|
|
|
|
|
|
+ _timezone = -TIME_ZONE * 3600;
|
|
|
GetTime();
|
|
GetTime();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -49,15 +51,16 @@ void GetTime(){
|
|
|
printf("NTP time is: %02d:%02d:%02d\n", ntp_datetime->tm_hour, ntp_datetime->tm_min, ntp_datetime->tm_sec);
|
|
printf("NTP time is: %02d:%02d:%02d\n", ntp_datetime->tm_hour, ntp_datetime->tm_min, ntp_datetime->tm_sec);
|
|
|
printf("NTP date is: %02d.%02d.%02d\n\n", ntp_datetime->tm_mday, (ntp_datetime->tm_mon + 1), (ntp_datetime->tm_year + 1900));
|
|
printf("NTP date is: %02d.%02d.%02d\n\n", ntp_datetime->tm_mday, (ntp_datetime->tm_mon + 1), (ntp_datetime->tm_year + 1900));
|
|
|
|
|
|
|
|
- NutRtcSetTime(ntp_datetime);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // This isn't working...
|
|
|
|
|
- tm *test;
|
|
|
|
|
|
|
+ X12RtcSetClock(ntp_datetime);
|
|
|
|
|
|
|
|
- X12RtcGetClock(test);
|
|
|
|
|
|
|
|
|
|
- printf("RTC time is: %02d:%02d:%02d\n", test->tm_hour, test->tm_min, test->tm_sec);
|
|
|
|
|
- printf("RTC date is: %02d.%02d.%02d\n\n", test->tm_mday, (test->tm_mon + 1), (test->tm_year + 1900));
|
|
|
|
|
|
|
+ NutDelay(100);
|
|
|
|
|
+//
|
|
|
|
|
+// // This isn't working...
|
|
|
|
|
+// struct _tm* test;
|
|
|
|
|
+// X12RtcGetClock(test);
|
|
|
|
|
+//
|
|
|
|
|
+// printf("RTC time is: %02d:%02d:%02d\n", test->tm_hour, test->tm_min, test->tm_sec);
|
|
|
|
|
+// printf("RTC date is: %02d.%02d.%02d\n\n", test->tm_mday, (test->tm_mon + 1), (test->tm_year + 1900));
|
|
|
}
|
|
}
|
|
|
|
|
|