Repository navigation
feat: date-time-ms, a time.Time in unix milliseconds - #89
Merged
Merged
Conversation
An integer of format date-time-ms is a time.Time to the millisecond, written and read as unix milliseconds through jsonutil's TimeMarshalIntUnixMilli and TimeUnmarshalIntUnixMilli, or their For variants by member name where a document holds times of other forms too, as for unix seconds. A query parameter of the format is sent as UnixMilli and parsed with time.UnixMilli, and a recorded value becomes its time in a generated literal. The golden spec gains a query parameter and a DateWrapper member of the format; the roadmap entry goes. openapi and jsonutil are pinned to the commits that bring the format and the helpers, until MarkRosemaker/openapi#33 and MarkRosemaker/jsonutil#10 merge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This does the roadmap entry "Unix times in milliseconds". An integer of format
date-time-ms, such as1795464914123, is now atime.Timeto the millisecond. go-api-libs/ibkr's trades (trade_time_r) and portfolio summary (timestamp) are the first recordings with such values.How it's written and read
TimeMarshalIntUnixMilli/TimeUnmarshalIntUnixMilli, asdate-timeintegers use the seconds helpers.time.Timewrites them all.Forvariants name the members holding milliseconds, as for seconds. The golden spec does this:seenAtsits besideatin seconds and string times.strconv.FormatInt(v.UnixMilli(), 10), and the server parses withtime.UnixMilli.Changes
ir:FormatDateTimeMsmaps totime.Time, withisUnixMillibesideisUnix, which now leaves the format out.Field.IsUnixMilliandParam.IsUnixMilli, a third encoding inmarkEncodings, andDocument.HasUnixMilliTimeFields/UnixMilliTimeMembers.types.gen.go.tmplregisters the helpers.interactions.goturns recorded milliseconds into their time for a literal.seenquery parameter and aDateWrapper.seenAtmember of the format. I generated to a scratch directory and read the diff before applying it toapi.js,client.gen.go,server.gen.go,types.gen.goandir.json; it holds only the new parameter and member.unix_test.gochecks thatseenAtis written as1795464914123and reads back to the same instant.README/features.mddescribes it, and the roadmap entry goes.master, which have the format (feat: the date-time-ms format, a time in unix milliseconds openapi#33) and the helpers (feat: time.Time as unix milliseconds jsonutil#10).make readypasses.🤖 Generated with Claude Code
https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y