diff options
author | Thomas White <taw@physics.org> | 2023-02-20 08:21:23 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2023-02-20 08:25:19 +0100 |
commit | 273677e6696ea4efbcdbc199fc05bef9f2742130 (patch) | |
tree | b760f9a9f572a95387f7a3c104184d2439e06d1e | |
parent | d72137bce4e2c8b426235de6ecb924302c1094eb (diff) |
Move UTC offset to header
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | ntp_client.c | 1 | ||||
-rw-r--r-- | ntp_client.h | 5 |
3 files changed, 14 insertions, 2 deletions
@@ -42,7 +42,15 @@ Software -------- Edit `compile` to set the path to the Pico SDK, as well as your WLAN name and -password. Run it, then copy `build/morningtown.uf2` to the Pico. +password. + +Set your offset from UTC in ntp_client.h, e.g. for UTC+1: +``` +#define UTC_OFFSET_SEC 3600 +``` +Sorry, no automatic DST handling yet. + +Run `compile`, then copy `build/morningtown.uf2` to the Pico. Boot up sequence diff --git a/ntp_client.c b/ntp_client.c index 08f7783..1c25a83 100644 --- a/ntp_client.c +++ b/ntp_client.c @@ -56,7 +56,6 @@ typedef struct NTP_T_ { #define NTP_PORT 123 #define NTP_DELTA 2208988800 // seconds between 1 Jan 1900 and 1 Jan 1970 #define NTP_RESEND_TIME (10 * 1000) -#define UTC_OFFSET_SEC 3600 static void ntp_result(NTP_T *state, int status, time_t *result) diff --git a/ntp_client.h b/ntp_client.h index aedb411..f21f546 100644 --- a/ntp_client.h +++ b/ntp_client.h @@ -26,6 +26,11 @@ typedef struct NTP_T_ NTP_T; +/* Set your offset from UTC here, in seconds + * UTC+1 = 3600 + * Sorry, no automatic DST handling yet. */ +#define UTC_OFFSET_SEC 3600 + enum { NTP_DNS_ERROR, NTP_DNS_NO_ADDR, |