jnthas / clockwise

do-it-yourself, full-featured and smart wall clock device
https://clockwise.page
MIT License
264 stars 34 forks source link

Timezone error for America/Santiago #72

Open joyarzun opened 1 month ago

joyarzun commented 1 month ago

Hello there I've setup all and it's working but the timezone still appears to be incorrect. I've set America/Santiago and it should show 21:50 but it's showing 1:50. I did change to America/Sao_Paulo and it works. I've changed the NTP server to others but it still continue to showing the same. What else can I do? I'm using the Mario theme flashed from the web btw

joyarzun commented 1 month ago

More info: When I've set the Posix timezone for America/Santiago that is "<-04>4<-03>,M9.1.6/24,M4.1.6/24" the browser does a request like this: http://192.168.0.xxx/set?manualPosix=%3C-04%3E4%3C-03%3E,M9.1.6/24,M4.1.6/24 so it is doing a parsing of the symbols < and >. Then I did the request with cURL without doing the parsing and it worked:

curl 'http://192.168.0.xxx/set?manualPosix=<-04>4<-03>,M9.1.6/24,M4.1.6/24' \ -X 'POST' \ -H 'Accept: */*' \ -H 'Accept-Language: en-US,en;q=0.9,es-CL;q=0.8,es;q=0.7,pt;q=0.6' \ -H 'Connection: keep-alive' \ -H 'Content-Length: 0' \ -H 'Origin: http://192.168.0.209' \ -H 'Referer: http://192.168.0.209/' \ -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36' \ -H 'dnt: 1' \ -H 'sec-gpc: 1' \ --insecure

So the UI is failing to support < and > symbols that is Posix standard for some timezones

jnthas commented 1 month ago

Hi @joyarzun! It seems a bug in the manualPosix, maybe we should force avoiding URL encode. I'm wondering why it didn't work when you set America/Santiago. Have you tried set other NTP server that is not Google? It should work with timezone name.

joyarzun commented 1 month ago

Hi @joyarzun! It seems a bug in the manualPosix, maybe we should force avoiding URL encode. I'm wondering why it didn't work when you set America/Santiago. Have you tried set other NTP server that is not Google? It should work with timezone name.

Indeed, I've tried with others ntp servers but the result is the same, also I've tried with the eztime lib without success but it's works with America/Sao_Paulo or Pacific/Auckland, so I think we have two issues, first is a bug the the lib (this repo is affected only) and the second is the parsing of Posix timezone