Comments (6)
mJS is outside my expertise, I don't use it.
That said, here's your reason https://unix.stackexchange.com/questions/104088/why-does-tz-utc-8-produce-dates-that-are-utc8
Basically the POSIX tz formats are 3 letters plus the offset. But the offset has to be on the opposite sign. Hence why ["sys.tz_spec", "<+05>5"]
worked for you. Just use that one.
from mongoose-os.
May I suggest you go to the forum and search there ? I've answered this at the forum and even have working examples in Spanish
from mongoose-os.
Some questions:
- How did you read the time shown? Because the SNTP library shows you the unix timestamp on update regardless of your tz_spec value
- tz_spec only affects a very specific subset of functions. localtime_r is one of them, while other functions like the widely used
mg_time()
will only return unix time as it should. What are you using?
Time inside C functions, and specially on mongoose can be complicated for begginers. I would suggest, @alnunez, that you make a sample app if you think that indeed, this is a bug on the code.
Good luck!
from mongoose-os.
Here is the exact piece of code. A function that builds a message, including datetime. Timer.fmt() seems affected by tz_spec, because i tried different values, and all of them changed the time zone when printing timestamp.
function buildMsgUl(){
message_ul.sensor_id=DEVICE_ID;
let extTemperatureCstr = roundNdigitsTostr(getTempC(),2);
message_ul.temperature_ext=extTemperatureCstr;
let intTemperatureCstr = roundNdigitsTostr((5/9)*(ESP32.temp()-32),2);
message_ul.temperature_int=intTemperatureCstr;
let batVstr = getBatV();
message_ul.battery=roundNdigitsTostr(batVstr,2);
let timeunix = Timer.now();
let timestamp = Timer.fmt('%Y-%m-%d %H:%M:%S',timeunix);
message_ul.timestamp = timestamp;
}
from mongoose-os.
Well after some more experimentation i found some discrepancies in tz for America/Bogota as follows:
from: https://github.com/mamuesp/timezones "America/Bogota":"<-05>5"
This value doesn't work, gave time UTC+5
from: https://github.com/openwisp/netjsonconfig/blob/master/netjsonconfig/backends/openwrt/timezones.py "America/Bogota", "COT5"
This value Works OK as expected (gave time UTC-5 )
from mongoose-os.
mJS is outside my expertise, I don't use it.
That said, here's your reason https://unix.stackexchange.com/questions/104088/why-does-tz-utc-8-produce-dates-that-are-utc8
Basically the POSIX tz formats are 3 letters plus the offset. But the offset has to be on the opposite sign. Hence why
["sys.tz_spec", "<+05>5"]
worked for you. Just use that one.
That's the answer i was looking for! thanks again!
from mongoose-os.
Related Issues (20)
- ESP-IDF update for ESP-32 to protect against Braktooth HOT 1
- Self re-trigger crashes with stack canary or double exception (ESP32) HOT 2
- Camera connect
- ESP32 reboots continuously after flashing new build.
- Possible race issues? HOT 1
- Running out of RAM during OTA update HOT 2
- Failed to flash ESP32-S2 HOT 1
- Resource leaks HOT 2
- Potential resource leaks HOT 2
- Adding api_timer.js gave core dump HOT 7
- Power Management in ESP32 HOT 4
- Undefined reference to `ping_start'
- Support for ESP32-S3
- Google Cloud IoT Core will no longer be a service on August 16th, 2023 HOT 1
- esp32-c3 build fails with `unknown CMake command "add_prebuilt_library"` HOT 5
- mos fails to launch - Windows 10 HOT 2
- Mongoose OS using mongoose 6.18 with bugs in it
- ESP32 MQTT Broker Over WS HOT 3
- Certificate of build.mongoose-os.com expired HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongoose-os.