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

fix wrong time format for UTC timestamp #1686

Merged
merged 1 commit into from Jun 16, 2023

Conversation

dkneisz
Copy link
Contributor

@dkneisz dkneisz commented Jun 16, 2023

Description:

fixes wrong format of timestamp introduced with #1677

Checklist:

  • The pull request is done against the latest development branch
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • I accept the DCO.

@DigiH
Copy link
Collaborator

DigiH commented Jun 16, 2023

Hi @dkneisz thanks for the fix of the time zone naming.

Now that we have the chance, and as Z(ulu) time and UTC are identical, but UTC is generally being used to define time zones around the world with UTC +/- X, and it being less militaristic than Zulu time …

@dkneisz @1technophile
… should we finalise it with a change to UTC?

Would that also work with your OpenHAB set up?

@dkneisz
Copy link
Contributor Author

dkneisz commented Jun 16, 2023

@DigiH I'm not sure what you mean by that. The "Z" in the UTC time just means that I's in the GMT timezone. Alternatively you could use "+0000" for that. Another option would be to just set the local timezone and use that in the UTC timestamp, but for some reason the function "gmtime" is used there.

@DigiH
Copy link
Collaborator

DigiH commented Jun 16, 2023

The function gmtime gives back the UTC - to just add a bit more to the naming confusion, as GMT strictly speaking is also identical to UTC and Z, but historically has changed and therefore still has different meanings for different people.

All I thought was that instead using the formatting "yyyy-MM-ddThh:mm:ssZ", we could have "yyyy-MM-ddThh:mm:ssUTC" for easier international recognition of the time stamp we give.

Let me quickly test it here …

@DigiH
Copy link
Collaborator

DigiH commented Jun 16, 2023

So with

  char buffer[sizeof "yyyy-MM-ddThh:mm:ssUTC"];
  strftime(buffer, sizeof buffer, "%FT%TUTC", gmtime(&now));

and then getting

…"UTCtime":"2023-06-16T14:13:00UTC"…

I just thought it might avoid possible confusion for some users with the Z, but with the key already saying UTCtime all is fine either way :)

Merging with the original Z

Thanks

@DigiH DigiH merged commit 126aa86 into 1technophile:development Jun 16, 2023
71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants