From a9df22e51f2096632474192babf08131df65b0c1 Mon Sep 17 00:00:00 2001 From: beegee-tokyo Date: Tue, 27 Sep 2016 20:34:34 +0800 Subject: [PATCH] Workaround for missing realtime_stamp --- Makefile | 4 ++-- syslog/syslog.c | 2 ++ syslog/syslog.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index df6806d..faee2d9 100644 --- a/Makefile +++ b/Makefile @@ -101,8 +101,8 @@ LED_SERIAL_PIN ?= 14 # --------------- esp-link modules config options --------------- -# Optional Modules mqtt rest socket webserver syslog -MODULES ?= mqtt rest socket webserver syslog +# Optional Modules mqtt rest socket web-server syslog +MODULES ?= mqtt rest socket web-server syslog # --------------- esphttpd config options --------------- diff --git a/syslog/syslog.c b/syslog/syslog.c index f359b85..5c88901 100644 --- a/syslog/syslog.c +++ b/syslog/syslog.c @@ -13,6 +13,7 @@ #include "syslog.h" #include "time.h" #include "task.h" +#include "sntp.h" extern void * mem_trim(void *m, size_t s); // not well documented... @@ -401,6 +402,7 @@ syslog_compose(uint8_t facility, uint8_t severity, const char *tag, const char * // create timestamp: FULL-DATE "T" PARTIAL-TIME "Z": 'YYYY-mm-ddTHH:MM:SSZ ' // as long as realtime_stamp is 0 we use tick div 10⁶ as date + uint32_t realtime_stamp = sntp_get_current_timestamp(); now = (realtime_stamp == 0) ? (se->tick / 1000000) : realtime_stamp; tp = gmtime(&now); diff --git a/syslog/syslog.h b/syslog/syslog.h index d556ee9..003ce89 100644 --- a/syslog/syslog.h +++ b/syslog/syslog.h @@ -71,7 +71,7 @@ enum syslog_facility { #define WDEV_NOW() REG_READ(0x3ff20c00) // This variable disappeared from lwip in SDK 2.0... -extern uint32_t realtime_stamp; // 1sec NTP ticker +// extern uint32_t realtime_stamp; // 1sec NTP ticker typedef struct syslog_host_t syslog_host_t; struct syslog_host_t {