aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-02-20 08:21:23 +0100
committerThomas White <taw@physics.org>2023-02-20 08:25:19 +0100
commit273677e6696ea4efbcdbc199fc05bef9f2742130 (patch)
treeb760f9a9f572a95387f7a3c104184d2439e06d1e
parentd72137bce4e2c8b426235de6ecb924302c1094eb (diff)
Move UTC offset to header
-rw-r--r--README.md10
-rw-r--r--ntp_client.c1
-rw-r--r--ntp_client.h5
3 files changed, 14 insertions, 2 deletions
diff --git a/README.md b/README.md
index b2b4490..d4cf34c 100644
--- a/README.md
+++ b/README.md
@@ -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,