Seeed-Solution / SenseCAP_Indicator_ESP32

SenseCAP Indicator SDK.
https://wiki.seeedstudio.com/SenseCAP_Indicator_How_To_Flash_The_Default_Firmware/#ESP-IDF
Apache License 2.0
32 stars 22 forks source link

Timezone Issue #25

Closed anarchistdevop closed 9 months ago

anarchistdevop commented 10 months ago

I have tried compiling the indicator_ha, indicator_basis & indicator_openai examples and I am able to build and flash the binaries without any problems.

The time however is always wrong, it is 30 minutes behind the actual time, The date and timezone city show correct values, wifi is connected and the monitor shows the correct zone and time are being pulled from the NTP Server.

The displayed time is 12:01 for the below NTP sync.

HTTP/1.1 200 OK Server: nginx/1.18.0 (Ubuntu) Date: Fri, 08 Sep 2023 07:01:41 GMT Content-Type: application/json; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive

177 {"timeZone":"Asia/Kolkata","currentLocalTime":"2023-09-08T12:31:41.8409605","currentUtcOffset":{"seconds":19800,"milliseconds":19800000,"ticks":198000000000,"nanoseconds":19800000000000},"standardUtcOffset":{"seconds":19800,"milliseconds":19800000,"ticks":198000000000,"nanoseconds":19800000000000},"hasDayLightSaving":false,"isDayLightSavingActive":false,"dstInterval":null} 0

In indicator_time.c zone is set to int8_t and in indicator_city.c it is set to float, i tried setting it to float in both locations but that does not help. ( I'm assuming my timezone needs to be UTC+5.5(float) and not UTC+5(int) )

Wvirgil123 commented 9 months ago

Hi,Here it has been set to floating point calculation.

https://github.com/Seeed-Solution/SenseCAP_Indicator_ESP32/blob/459fb0b8de1b8c823385e5185b5fdb482aed80c9/examples/indicator_basis/main/model/indicator_city.c#L755

Can you help me print the net_zone string data at this location? https://github.com/Seeed-Solution/SenseCAP_Indicator_ESP32/blob/459fb0b8de1b8c823385e5185b5fdb482aed80c9/examples/indicator_basis/main/model/indicator_time.c#L106

the-confused-genius commented 4 months ago

@Love4yzp do we have any fix for this ?, i am facing the same issue

the-confused-genius commented 4 months ago

After about 24 hours of debugging i found a fix.

image It looks like the rest of the code is expecting a UTC offset string in the following format "UTC-5:30" but what actually the code is receiving is "UTC-5.5"

Note : my UTC offset is +5:30 but here in the code the positive and negative signs have switched roles

You can either add a temporary fix and hardcode the value like i have done in the screenshot, in my case "UTC-5:30"

or add additional check that converts the '.5' to ':30'