Merge pull request #561 from JeremiasStotter/master

Look up the timezone when an entry is recorded and store it
This commit is contained in:
Jan-Piet Mens
2026-01-11 08:35:58 +01:00
committed by GitHub
2 changed files with 15 additions and 2 deletions
+14 -1
View File
@@ -55,7 +55,10 @@
#endif
#include "version.h"
#include <dirent.h>
#ifdef WITH_TZ
# include "zonedetect.h"
extern ZoneDetect *zdb;
#endif
#define SSL_VERIFY_PEER (1)
#define SSL_VERIFY_NONE (0)
@@ -1056,6 +1059,16 @@ void handle_message(void *userdata, char *topic, char *payload, size_t payloadle
}
}
#ifdef WITH_TZ
if ((j = json_find_member(json, "tzname")) == NULL) {
char* tz_str = ZDHelperSimpleLookupString(zdb, lat, lon);
if (tz_str) {
json_append_member(json, "tzname", json_mkstring(tz_str));
ZDHelperSimpleLookupStringFree(tz_str);
}
}
#endif
if ((j = json_find_member(json, "_geoprec")) != NULL) {
if (j->tag == JSON_STRING) {
geoprec = atoi(j->string_);
+1 -1
View File
@@ -46,7 +46,7 @@ static struct gcache *gc = NULL;
#ifdef WITH_TZ
# include "zonedetect.h"
static ZoneDetect *zdb = NULL;
ZoneDetect *zdb = NULL;
#endif
void storage_init(int revgeo)