-
Notifications
You must be signed in to change notification settings - Fork 166
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
[Bug]Generator using fromUnixTimeSeconds for unixTimestamp with int64 #4189
Comments
We are calling the wrong method all day along: autorest.csharp/src/AutoRest.CSharp/Common/Output/Builders/JsonSerializationMethodsBuilder.cs Line 1154 in fa9971f
But all the information I could find, such as:
The typespec doc here never says it is milliseconds or seconds, it looks like milliseconds |
I'm pretty sure it is milliseconds. TypeSpec is heavily influenced by JavaScript, and the JS https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date |
@ArcturusZhang: If this is a simple fix to call |
@bterlson, this was intended as seconds, not milliseconds, right? |
@johanste, @bterlson: Best issue for discussion is microsoft/typespec#2887 |
@ArcturusZhang: Per discussion in microsoft/typespec#2887, it seems that the intention of |
So I bring this up because of being afraid there would be debates like this because it is really unclear on typespec documents, and different person with different background would have different comprehension on the work "unix timestamp". My first thought is that this is "seconds". Service teams (slash typespec authors) might also have the same confusion depending on their background - therefore this is really ambiguous. |
Close this because our current behavior is correct |
@ArcturusZhang: If you have any more feedback not already captured microsoft/typespec#2887, please add it to that issue. |
Describe the issue or request
When defining the createTime as @encode(DateTimeKnownEncoding.unixTimestamp, int64) in TypeSpec, the generator uses FromUnixTimeSeconds.
However, in the service use case, the createTime is in milliseconds. So an error for out-of-range is raised.
Here is the sample for createTime/updateTime.
Describe your ideas for solutions
Please describe how you think a change or changes might work. Consider
how these changes might work for multiple services.
Add labels
As appropriate, select a label to describe how hard the issue is to work
around or how hard it would be to do without a particular feature that
could help make it easier. These labels start with "workaround".
Also select a label that describes how many instances of the workaround
you would have to do without the bug being fixed or feature implemented.
These labels start with "instances".
These labels will help priority bug fixes and feature requests.
If this bug or feature request is for older versions of autorest, please
remove the v3 label and add the v2 label as appropriate.
The text was updated successfully, but these errors were encountered: