-
Notifications
You must be signed in to change notification settings - Fork 19
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
Change timestamp format #106
Comments
The absence of .123 miliseconds poses a problem when one has multiple events generated in 1 second. looking at https://w3c.github.io/wot-profile/#date-format I can see the following:
and https://www.w3.org/TR/xmlschema-2/#dateTime under 3.2.7.1 says:
I think the current Utils.timestamp() should be upgraded asap, and just use Date.toISOString() |
Thanks for this valuable feedback, I agree that one second resolution is not enough. Regarding the WoT Profile specification, I'm afraid the situation is still in flux because there are still inconsistent and broken references which need fixing. I have an open pull request which suggests consolidating on RFC 3339. I need to check whether Date.toISOString() conforms with that specification, which is a kind of a profile of ISO 8601, but I think that it probably does. |
The latest draft of WoT Profile only requires that timestamps conform to RFC3339, which does allow both numerical timezone offsets and "Z". As I understand it that means the timestamps used by the gateway do now comply with the specification. However, I think we should still change the gateway to use Date().toISOString() directly to allow millisecond precision timestamps. |
Utils.timestamp() currently generates timestamps in the following format:
2022-01-20T17:21:12+00:00
For some reason the default output of
Date().toISOString()
is modified so that it ends in "+00:00" rather than "Z". This is probably because that's the format used by the examples do in the Web Thing API specification.The latest draft of the W3C WoT Profile specification constrains the date format so that it must end in "Z".
I therefore propose changing the timestamp method to return the raw output of
Date().toISOString()
rather than modify it, so that datestamps look like:2011-10-05T14:48:00.000Z
Before doing this we should check if it breaks anything.
Also, double check that the milliseconds portion of the datestamp is expected by WoT Profile.
Note: These timestamps are used in action resources in the gateway's API to show the requested and completed times of an action, and also for the timestamps of events. I'm not really sure why the gateway uses this utility function from the add-on library and they can probably call
Date().toISOString()
directly instead. If this utility function isn't used anywhere else then it could probably just be removed.The text was updated successfully, but these errors were encountered: