Nodemcu-firmware: SNTP Feature Request

Created on 7 Aug 2017  路  6Comments  路  Source: nodemcu/nodemcu-firmware

8<------------------------ FEATURE REQUEST ------------------------------------

Missing feature

ADD decimal number to sntp.setoffset() like 1.5 , 2.5 , 3.5 , 4.5 , .... or -1.5 , -2.5 , -3.5 , ....

Justification

many region time have this offset's

8<------------------------ END FEATURE REQUEST --------------------------------

All 6 comments

Seems to me that you're (ab)using the SNTP offset for timezone handling? It's intended for a different use case, see https://nodemcu.readthedocs.io/en/latest/en/modules/sntp/#sntpsetoffset and https://stackoverflow.com/questions/44166414/nodemcu-time-zone-based-sntp-synchronization.

If you want to do timezone handling, then take a look at https://github.com/nodemcu/nodemcu-firmware/tree/master/lua_examples/timezone which is a complete implementation of timezone support.

@pjsg can help me to try it step by step??
i try this module with this way:
1-upload eastern.zone in file system with nodemcu-tool command
2-upload tz.lua module in file system
and write this example code
```
tz = require('tz')
tz.setzone('eastern')
sntp.sync(nil, function(now)
local tm = rtctime.epoch2cal(now + tz.getoffset(now))
print(string.format("%04d/%02d/%02d %02d:%02d:%02d", tm["year"], tm["mon"], tm["day"], tm["hour"], tm["min"], tm["sec"]))
end)

```
and this returned 馃憤
tz.lua:32: attempt to index global 'struct' (a nil value)

You need the NodeMCU struct module in the firmware.

ow yeah ,, its solved .. now seem module work correctly .
now for example how i try to set timezone . here i upload eastern.zone in file system ... how to chenge offset? because its offset sets to -5 and seem its not make for change it

or in other hand whats place for download timezone.zone files for other or all regions?

i founded it from that source

On my linux system, these files can be found in /usr/share/zoneinfo.

thanks alot

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pastukhov picture pastukhov  路  6Comments

v1993 picture v1993  路  5Comments

ildar picture ildar  路  5Comments

tibinoo picture tibinoo  路  5Comments

marcelstoer picture marcelstoer  路  4Comments