luc-github / ESP3D

FW for ESP8266/ESP8285/ESP32 used with 3D printer
GNU General Public License v3.0
1.78k stars 466 forks source link

[BUG]<When uploading a file, the file creation time does not calculate the time zone> #913

Closed liqijian101 closed 1 year ago

liqijian101 commented 1 year ago

When uploading a file, the file creation time does not calculate the time zone. For example, my time zone is - 8, and the upload time is 10:00 on April 2, 2023. After the file is uploaded, the display time is 18:00 on April 2, 2023.

luc-github commented 1 year ago

Indeed the set time was messy - I did not really tested - I pushed to later and of course was buggy - sorry
1 - Internet time was never actually enabled only webui set the time was enabled 2 - WebUI initialization time string had a typo so time was not set properly 3 - some settimeofday parameters were not correct

So you need to update ESP3D and ESP3D-WEBUI to get full working solution

I have tested with my local time zone (+8) and now everything seems ok using internet time or manual time

DivingDuck commented 1 year ago

Maybe an additional point. It would be nice to see an actual date and time info so that we can recognize when the setting is wrong, e.g on the about page.

luc-github commented 1 year ago

you mean [ESP140]NOW ?

DivingDuck commented 1 year ago

Yes, like this should be fine

luc-github commented 1 year ago

It is the case already ^_^ http://esp3d.io/esp3d/v3.x/documentation/commands/index.html

Sync / Set / Get current time
[ESP140]<SYNC> <srv1=XXXXX> <srv2=XXXXX> <srv3=XXXXX> <zone=xxx> <dst=YES/NO> <time=YYYY-MM-DDTHH:mm:ss> <NOW> json=<no> pwd=<admin password>
DivingDuck commented 1 year ago

yea, this is what I had seen in the code yesterday.

[ESP140] srv1=192.168.178.1, srv2=169.254.1.1, srv3=194.25.134.196, zone=2, dst=YES

I'm just build new binaries to see your last update. Still think, it would be nice to have it in the about section as I don't need to remember all the commands, it is still more intuitive as this page show most of the important settings with one click (and I like it very much) :)

luc-github commented 1 year ago

You do not need to remember just type [ESP0]or even [ESP0]140 Ho you mean display date/time of ESP in WebUI ? well I though about it but the issue is the query is done once when you open page so it will weird to still display the same time after a while, and always refresh the time is waste of bandwidth

I did not found an efficient way to check date time of ESP

DivingDuck commented 1 year ago

Maybe with click on refresh for asking once the information

Edit: I just upload the new binaries and web interface. It still shows only

[ESP140]
srv1=192.168.178.1, srv2=169.254.1.1, srv3=194.25.134.196, zone=2, dst=YES
[ESP800]
FW version:3.0.0.a224
FW target:smoothieware
FW ID:40
Setup:Enabled
SD connection:none

Btw, my time server is my router

luc-github commented 1 year ago
[ESP140]NOW
;2023-04-03 16:07:39
[ESP800]
;FW version:3.0.0.a224
;FW target:unknown
;FW ID:0
;Setup:Enabled
;SD connection:none
;Serial protocol:Raw
;Authentication:Disabled
;Web Communication:Synchronous
;Web Socket IP:192.168.2.218
;Web Socket Port:81
;Hostname:esp3d
;WiFi mode:STA
;Web update:Enabled
;Flash File System:LittleFS
;Host Path:/
;Time:Auto
DivingDuck commented 1 year ago

Oh, I forgot NOW...

I need to set it to utc+1 for getting the correct time, but it should be utc+2 as we have a summer / winter time change.

https://time.is/en/Germany

luc-github commented 1 year ago

did you enabled daylight/DST ?

Reading : https://github.com/espressif/arduino-esp32/issues/7416 It seems something changed (at least in esp32) and I need to review summer time management

luc-github commented 1 year ago

Actually I though DST was applied as setting by NTP server itself , it seems no - the NTP server give the time then you have to apply the DST by yourself, because ntp server does not care daylight saving, because it is per country / at specific date etc... This is confusing - so currently it is up to user to says it apply DST and when he want to apply DST, it is not automatic.

To apply DST automaticaly need to add extra library orz...

EDIT: to apply need to know the location which request user to set it or add an IP detection - then based on this information need to download and parse a Rule file like https://github.com/eggert/tz, then apply the DST is necessary Sorry I think I will let the feature Manual for a while Another solution is to disable Internet Time, the time will be set by your browser each time you open webUI

DivingDuck commented 1 year ago

Yes i had enable it, but disable it shows the correct time. It should be yes.

I also struggle with this settings, to be honest. (I was just thinking to to make new backups for my applications with DS18B20 sensors because they show the correct time and I hadn't build the applications new now for quite some time. This was a friendly reminder for it ... )

Here is my setting for now displaying the correct time:

[ESP140]
srv1=192.168.178.1, srv2=169.254.1.1, srv3=194.25.134.196, zone=2, dst=NO
[ESP140] NOW
2023-04-03 11:02:07
luc-github commented 1 year ago

It should be yes.

If you set to Yes it add extra hour , so this setting fry my brain to be honest, because set to 0 does not apply the DST*3600 in sample esp32 and esp8266 have same behavior and code is here

I will wait winter to see what is the NTP server response and how DST affect the time

luc-github commented 1 year ago

@liqijian101 does it fix the issue on your side ? Can I close issue ?

liqijian101 commented 1 year ago

I have just tested the new code and can now display the correct time. Thanks.

luc-github commented 1 year ago

thank you for the feedback, I close issue then

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.