-
Notifications
You must be signed in to change notification settings - Fork 13
fix(kotlin)!: migrate timestamps to kotlin.time.Instant #2556
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
base: release/10.x
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package com.wire.crypto | ||
|
|
||
| import java.nio.ByteBuffer | ||
| import kotlin.test.Test | ||
| import kotlin.test.assertEquals | ||
| import kotlin.time.Instant | ||
|
|
||
| class TimestampTest { | ||
| @Test | ||
| fun timestampPreservesNanosecondsAcrossFfiConversion() { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the purpose of this test?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was meant to check the new Instant type and nanosecond precision, but it mostly tests the generated converter. I'll remove it |
||
| val instant = Instant.fromEpochSeconds(1_700_000_000, 123_456_789) | ||
| val timestamp: Timestamp = instant | ||
| val buffer = ByteBuffer.allocate(FfiConverterTypeTimestamp.allocationSize(timestamp).toInt()) | ||
|
|
||
| FfiConverterTypeTimestamp.write(timestamp, buffer) | ||
| buffer.flip() | ||
| val restored: Instant = FfiConverterTypeTimestamp.read(buffer) | ||
|
|
||
| assertEquals(instant, restored) | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.