My goal is: to fetch current local time .
My actions are: I have included SNTP library in mos.yml, configured sys.tz_spec, and invoked Timer.now() function.
The result I see is: Time as UTC, not local time, no matter what I set in sys.tz_spec
My expectation & question is:
I am expecting to get the current local time (in my timezone). As that is what was answered here
However, I always get UTC.
What am I missing ?
Logs follow
[Jun 3 15:51:30.447] mgos_core.c:104 Setting TZ to '<-03>3'
[Jun 3 15:51:35.723] mgos_sntp.c:95 SNTP query to time.google.com
[Jun 3 15:51:35.909] mgos_sntp.c:59 SNTP reply from 216.239.35.12: time 1591210296.611131, local 5.702667, delta 1591210290.908464
[Jun 3 15:51:35.922] init.js:10 Timer.now() returns 1591210296.612774
[Jun 3 15:51:49.024] mgos_http_server.c:180 0x3ffcb0a8 HTTP connection from 192.168.69.11:40338
[Jun 3 15:51:49.031] mg_rpc.c:293 Do.now via HTTP 192.168.69.11:40338
[Jun 3 15:51:49.045] init.js:10 Timer.now() returns 1591210309.734524
1591210309 Is equivalent to: 06/03/2020 @ 6:51pm (UTC); ART is as mos shows (-3)
[Jun 3 15:53:31.438] mgos_core.c:104 Setting TZ to 'EST5EDT4,M4.1.0/02:00:00,M10.5.0/02:00:00'
[Jun 3 15:53:37.010] mgos_sntp.c:95 SNTP query to time.google.com
[Jun 3 15:53:37.199] mgos_sntp.c:59 SNTP reply from 216.239.35.8: time 1591210418.197341, local 6.007640, delta 1591210412.189701
[Jun 3 15:53:37.212] init.js:10 Timer.now() returns 1591210418.198974
[Jun 3 15:53:49.718] mgos_http_server.c:180 0x3ffcb118 HTTP connection from 192.168.69.11:40352
[Jun 3 15:53:49.725] mg_rpc.c:293 Do.now via HTTP 192.168.69.11:40352
[Jun 3 15:53:49.738] init.js:10 Timer.now() returns 1591210430.724517
1591210418 Is equivalent to: 06/03/2020 @ 6:53pm (UTC); EST is expected