Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI - Status page - Current time should be local time, not UTC time #2608

Closed
brunetton opened this issue Jun 19, 2024 · 1 comment
Closed

Comments

@brunetton
Copy link

brunetton commented Jun 19, 2024

Device

itead-sonoff-dual-r2

Version

1.16.0-dev.git7536a6ed+github240615

Bug description

Time displayed in UI is UTC time, not local time

Steps to reproduce

Context

  • I'm living in France; timezone is now summer time (CEST, ie UTC+2)
  • local time is 00:04 (yes I should go to bed)

Steps

  • in console logs I can see
    [421878] [NTP] Server    pool.ntp.org
    [421880] [NTP] Last Sync 2024-06-19 22:04:32 (UTC)
    [421880] [NTP] UTC Time  2024-06-19 22:04:32
    [421881] [NTP] Local Time 2024-06-19 23:04:32 (CET)
    
    => that's correct: current time is 23:04 CET
  • when opening device UI, "Current time" is 2024-06-19 22:04:32

That is not correct, it should be either:

  • 2024-06-19 22:04:32 UTC
  • or better: 2024-06-19 23:04:32 CET

Note

I'm not asking for summer time support in Espurna, I can manually manage this in my schedules

get ntpTZ
> ntpTZ => "CET"
+OK

Build tools used

No response

Any relevant log output (when available)

No response

Decoded stack trace (when available)

No response

@mcspr
Copy link
Collaborator

mcspr commented Jun 24, 2024

2024-06-19 22:04:32 UTC
or better: 2024-06-19 23:04:32 CET

What about explicit offset then? Currently, there is none

2024-06-19 22:04:32

Commit above adds +HH:MM offset at the end for the status page

2024-06-19 22:04:32 +01:00

Internally, this looks slightly different though

2024-06-19T22:04:32+01:00

In case of UTC

2024-06-19T21:04:32Z

fwiw ntpTZ is not really a TZ name, but a specification string for either plain offset or DST settings. In case of CET / CEST - CET-1CEST,M3.5.0,M10.5.0/3 - outputting that near the timestamp would be pretty verbose. Although, while it seems it would be possible to extract text strings for DST and non-DST, libc routines that are used for timezones are not actually returning the numerical offset for DST and non-DST :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants