-
Notifications
You must be signed in to change notification settings - Fork 9
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
Should created and modified times be precise to exactly 3 digits after the decimal place in seconds? #219
Comments
nice find! |
This was intentional, I can help explain the original reasoning behind it. Like many things, it goes back to a compromise...in this case, the Great Timestamp Precision Debate of 2017 (or whenever). We were worried about the ambiguity of the exact situation you're mentioning:
Per our precision rules, the first timestamp isn't implicitly Given the lack of precision, if you follow the rules exactly you wouldn't know for sure whether the second one should come before or after the first. Obviously we can go back and revisit...I think in a few cases we wrote ourselves into weird corners in an effort to make as many people happy as possible. |
@johnwunder - |
I think the key is that our original compromise was based on a hypothetical and theoretical discussion. Now we are starting to get real implementations. Also the debate was around, what should we do and some people saying that their devices can not produce timestamps with more precision than a 1 second level. Others said that milli second was sufficient. Maybe we should say that people SHOULD use micro second level precision but MAY milli second if their product does not support microsecond level precision. |
Yeah it seems like it should be changed. One option is to just say that when comparing values for versioning purposes you just assume infinite precision (e.g. "27.5" becomes "27.500000000..." and is therefore smaller than "27.51"). This is probably what would happen when you parsed those numbers in most libraries anyway. |
Talked about this on the 2020-02-18 working call and the consensus was to make a change that said you "MUST use at least mili-second precision". John-Mark is going to propose some text to cover a corner case. |
Suggested additional text: Note that precisions larger than nanosecond may not be very interoperable or usable, as conversion to UNIX epoch time stamps are often either limited to nanoseconds, or when stored as a floating point number, would lose precision in single precision. Not sure if we want to add an implementation consideration about incrementing modified time of the new object or not. |
We added this text to 2.16.1
|
We replaced text in 3.2 for created and modified to say
and
|
Rich P and I talked about the other suggested text and we do not feel that it is actually required due to the fact that the timestamp value is made up of more than just the precision. So if, in the future a producer creates a new version of the object, and is now using micro second precision, then the rest of the timestamp value will be different, not just the precision. If we are missing something, or did not understand your suggestion correctly, please let us know. |
For created and modified properties the spec says:
Maybe the spec didn't mean to imply this - but it seems to say that the time should not have more than three digits after the decimal place in seconds
During implementation of python_stix2, when testing the new_version functionality, two versions were made within the same millisecond - which means that these two object versions are indistinguishable. The solution was to add a millisecond if a version already exists with the exact same modified time.
I wonder if this is the best way to deal with this situation. If we could have more precision (i.e., more than 3 digits), we could distinguish the two without putting one of them into "the future".
This could get even messier if you could make "n" versions within the same millisecond.
So instead of:
"2020-02-07T14:02:17.833Z"
"2020-02-07T14:02:17.834Z"
it would be:
"2020-02-07T14:02:17.833Z"
"2020-02-07T14:02:17.8331Z"
And the spec text could read:
The text was updated successfully, but these errors were encountered: