mirror of
https://github.com/owntracks/recorder.git
synced 2026-02-13 20:49:51 +00:00
Look up the timezone when an entry is recorded and store it
With big rec files, lookup might be incredibly slow because the timezone will be looked up for every entry. Like this, timezone is recorded once when an entry is created and doesn't have to be looked up later
This commit is contained in:
15
recorder.c
15
recorder.c
@@ -55,7 +55,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
#ifdef WITH_TZ
|
||||||
|
# include "zonedetect.h"
|
||||||
|
extern ZoneDetect *zdb;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SSL_VERIFY_PEER (1)
|
#define SSL_VERIFY_PEER (1)
|
||||||
#define SSL_VERIFY_NONE (0)
|
#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 = json_find_member(json, "_geoprec")) != NULL) {
|
||||||
if (j->tag == JSON_STRING) {
|
if (j->tag == JSON_STRING) {
|
||||||
geoprec = atoi(j->string_);
|
geoprec = atoi(j->string_);
|
||||||
|
|||||||
Reference in New Issue
Block a user