Skip to content
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

Add crate for integration with the AWS SDK for Rust #260

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

snaggen
Copy link

@snaggen snaggen commented Feb 12, 2025

I have implemented some basic conversion from the AWS Smithy type DateTime into/from Timestamp and Zoned.

@snaggen snaggen force-pushed the aws branch 2 times, most recently from 8c795d0 to 8a8cdbc Compare February 12, 2025 07:31
@robertbastian
Copy link
Contributor

Wouldn't this be better in aws_smithy_types_convert like the chrono and time conversions?

@snaggen
Copy link
Author

snaggen commented Mar 2, 2025

I created a PR for that previously, but they didn't want to add it since jiff isn't stable yet.

@BurntSushi
Copy link
Owner

Ref smithy-lang/smithy-rs#3826

I'll get to reviewing this soon, after I get through the batch of changes related to core-only work.

@snaggen
Copy link
Author

snaggen commented Mar 2, 2025

Ref smithy-lang/smithy-rs#3826

I'll get to reviewing this soon, after I get through the batch of changes related to core-only work.

No, worries.... it is just some simple convenience helpers, so it is not like my code is dependent on this :)

@fiadliel
Copy link
Contributor

fiadliel commented Mar 8, 2025

The nanosecond portion of a jiff Timestamp are negative for times before the Unix epoch (it ranges between +1s and -1s), this should be taken into account (e.g. the type casts between u32 and i32 are incorrect).

@snaggen
Copy link
Author

snaggen commented Mar 8, 2025

The nanosecond portion of a jiff Timestamp are negative for times before the Unix epoch (it ranges between +1s and -1s), this should be taken into account (e.g. the type casts between u32 and i32 are incorrect).

The smithy datetime is defined as seconds and nano seconds since unix epoch, so a simple check for that should fix this. I will have a look at it later.

@snaggen
Copy link
Author

snaggen commented Mar 11, 2025

@fiadliel Ok, it seems that I was wrong about DateTime being only positive. But I have added nano second conversions for times before epoc. Please have a look and see if it looks correct to you. I checked for conversion the other way also, but that seems to be handled by jiff automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants