If you are asking a question, please follow this template:
- My goal is: To get the current local time in my timezone(Philippines)
- My actions are: I have included SNTP library in mos.yml, and added sys.tz_spec in config, and invoked Timer.now() function.
heres my config.yml:
config_schema:
- ["mqtt.server", "iot.eclipse.org:1883"]
- ["i2c.enable", true]
- ["sys.tz_spec", "s", "", {title: "See formats for the TZ env var: \"man tzset\". Formats like \":/path/to/file\" are not supported"}]
tags:
- js
filesystem:
- fs
libs:
- origin: https://github.com/mongoose-os-libs/boards
- origin: https://github.com/mongoose-os-libs/js-demo-bundle
- origin: https://github.com/mongoose-os-libs/rpc-service-config
- origin: https://github.com/mongoose-os-libs/rpc-service-fs
- origin: https://github.com/mongoose-os-libs/rpc-uart
- origin: https://github.com/mongoose-os-libs/wifi
- origin: https://github.com/mongoose-os-libs/dht
- origin: https://github.com/mongoose-os-libs/mjs
- origin: https://github.com/mongoose-os-libs/sntp
heres my init.js code:
load('api_config.js');
load('api_rpc.js');
load('api_timer.js');
load('api_math.js');
Timer.set(2000 /* milliseconds */ , Timer.REPEAT, function() {
let now = Timer.now();
let s = Timer.fmt('%x %X:%p', now);
print(s)
}, null);
- The result I see is: instead of my local timezon in ph, I got this
[Nov 10 11:21:30.351] 11/10/20 03:21:45:AM
[Nov 10 11:21:30.351] 11/10/20 03:21:45:AM
- My expectation & question is: How can I get my current local time in my timezone?? Iām not sure about my sys.tz_spec config did I miss something?