LoRaWanGateway icon indicating copy to clipboard operation
LoRaWanGateway copied to clipboard

add localization to the time stamps

Open dlarue opened this issue 7 years ago • 3 comments

By adding CONFIG["GW_TZOFFSET"] = "-8" for PST and crate a localtime function instead of gmtime using this offset times the 3600(num sec in 1 hour). Currently get error though.

local function localtime(t,us) -- HOW TO DO THIS? rtctime.epoch2cal doesn't like my "fixed" epoch time local lt = t + CONFIG["GW_TZOFFSET"] * 3600 local tm = rtctime.epoch2cal(lt) return string.format('%04d-%02d-%02d %02d:%02d:%02d GMT',tm["year"],tm["mon"],tm["day"],tm["hour"],tm["min"],tm["sec"]) end

dlarue avatar Apr 17 '17 20:04 dlarue

LoraWAN (at least TTN) expects the dates in the json messages to be GMT. In the TTN console they are displayed in your own timezone (at least, for me that is true).

Why do you want to use localtime?

JaapBraam avatar Apr 17 '17 20:04 JaapBraam

For use in local server and dbases.

On Apr 17, 2017 1:38 PM, "Jaap Braam" [email protected] wrote:

LoraWAN (at least TTN) expects the dates in the json messages to be GMT. In the TTN console they are displayed in your own timezone (at least, for me that is true).

Why do you want to use localtime?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JaapBraam/LoRaWanGateway/issues/28#issuecomment-294585809, or mute the thread https://github.com/notifications/unsubscribe-auth/ADATWOE6FRRz5gZBRBEy5c4xfvtH-DEdks5rw83SgaJpZM4M_h9t .

dlarue avatar Apr 17 '17 20:04 dlarue

FYI, my thought was to add it like this so it could be 0 for normal operation.

CONFIG["GW_TZOFFSET"]="0" -- PST CONFIG["GW_TZOFFSET"]="-8"

On Mon, Apr 17, 2017 at 1:41 PM, Doug LaRue [email protected] wrote:

For use in local server and dbases.

On Apr 17, 2017 1:38 PM, "Jaap Braam" [email protected] wrote:

LoraWAN (at least TTN) expects the dates in the json messages to be GMT. In the TTN console they are displayed in your own timezone (at least, for me that is true).

Why do you want to use localtime?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JaapBraam/LoRaWanGateway/issues/28#issuecomment-294585809, or mute the thread https://github.com/notifications/unsubscribe-auth/ADATWOE6FRRz5gZBRBEy5c4xfvtH-DEdks5rw83SgaJpZM4M_h9t .

dlarue avatar Apr 18 '17 02:04 dlarue