FasterXML / FasterXML/jackson-modules-java8
Instants get not deserialized as expected sometimes (millis vs nanos, non-fractional numbers)
- 主要語言
- Java
- 星號
- 425
- 分支
- 124
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Hey guys,
I bumped into this issue and it took me some time to figure out what was wrong on my side.
Maybe you don't even consider this as an issue but let me explain first what happened on my side.
When having the flag disabled for WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS
It will eventually write timestamps in Milliseconds:
`1709296652087`
When I now missed the flag READ_DATE_TIMESTAMPS_AS_NANOSECONDS
and read this we will get an insane Instant consisting of:
Seconds `1709296652087`
and
Nanos `0`
Using any site online it would understand and consider it as a Milliseconds timestamp.
I guess usually you would just split up a timestamp with a dot and put it to Seconds and Nanos, but I think theoretically both should be possible.
So do you think we could have a feature where we parse values based on their length?
11 characters or less = Seconds
12 to 15 characters = Millis
16 to 18 characters = Micros
19 to 21 characters = Nanos
While writing I am realizing that this might feel less consistent but I also think this might be an interesting flag to add,
you be the judge.
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
先定位 READ_DATE_TIMESTAMPS_AS_NANOSECONDS 和 WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS 的處理方式,然後重現毫秒值 1709296652087 的反序列化。檢視如何區分整數時間戳與小數值,並在實作或測試所提議的選項之前,定義秒、毫秒、微秒和奈秒所需的行為。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- java
- 領域
- backend
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100