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

Replace chrono with time #529

Merged
merged 15 commits into from
Dec 9, 2021
Merged

Replace chrono with time #529

merged 15 commits into from
Dec 9, 2021

Conversation

olivereanderson
Copy link
Contributor

@olivereanderson olivereanderson commented Dec 6, 2021

Description of change

This PR removes all our direct dependencies on the chrono crate and introduces a dependency on time instead.

The changes introduced here are mainly visible internally in identity-core as I have tried to keep the changes to the Timestamp API to a minimum.

Links to any relevant issues

fixes issue #442

Type of change

Add an x to the boxes that are relevant to your changes.

  • Bug fix (a non-breaking change which fixes an issue)
  • Enhancement (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Fix

How the change has been tested

Runs under cargo test

Change checklist

Add an x to the boxes that are relevant to your changes.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@olivereanderson olivereanderson added Breaking change A change to the API that requires a major release. Part of "Changed" section in changelog Rust Related to the core Rust code. Becomes part of the Rust changelog. Wasm Related to Wasm bindings. Becomes part of the Wasm changelog Removed Feature removal that requires a major release. Part of "Removed" section in changelog labels Dec 6, 2021
Copy link
Contributor

@cycraig cycraig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the change.

parse needs to be updated to normalise the timezone to UTC+0 as per the DID specification and Timestamp needs more unit tests in general.

identity-core/src/common/timestamp.rs Outdated Show resolved Hide resolved
identity-core/src/common/timestamp.rs Show resolved Hide resolved
identity-core/src/common/timestamp.rs Outdated Show resolved Hide resolved
identity-core/src/common/timestamp.rs Outdated Show resolved Hide resolved
identity-core/src/common/timestamp.rs Outdated Show resolved Hide resolved
@cycraig cycraig changed the title migrate to time Replace chrono with time Dec 6, 2021
@cycraig
Copy link
Contributor

cycraig commented Dec 6, 2021

This isn't really a breaking change is it? No APIs are changed since we didn't expose chrono from Timestamp unless I'm mistaken?

@olivereanderson
Copy link
Contributor Author

olivereanderson commented Dec 6, 2021

This isn't really a breaking change is it? No APIs are changed since we didn't expose chrono from Timestamp unless I'm mistaken?

There are a few breaking changes introduced in this PR: One can no longer convert a chrono::ParseError to Error as a result of this change. The aforementioned change also replaces the wrapped value in the public enum which is another breaking change as far as I know. Furthermore the from_unix method is now fallible.

@olivereanderson olivereanderson removed the Removed Feature removal that requires a major release. Part of "Removed" section in changelog label Dec 6, 2021
@cycraig
Copy link
Contributor

cycraig commented Dec 6, 2021

Good points, I missed the from_unix change in particular.

Oliver E. Anderson and others added 6 commits December 7, 2021 09:29
Copy link
Contributor

@cycraig cycraig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes. Minor comments.

identity-core/Cargo.toml Outdated Show resolved Hide resolved
identity-core/src/common/timestamp.rs Outdated Show resolved Hide resolved
identity-core/src/common/timestamp.rs Outdated Show resolved Hide resolved
identity-core/src/common/timestamp.rs Outdated Show resolved Hide resolved
identity-core/src/common/timestamp.rs Outdated Show resolved Hide resolved
Oliver E. Anderson and others added 5 commits December 8, 2021 08:39
Co-authored-by: Craig Bester <craig.bester@iota.org>
Co-authored-by: Craig Bester <craig.bester@iota.org>
Co-authored-by: Craig Bester <craig.bester@iota.org>
Co-authored-by: Craig Bester <craig.bester@iota.org>
@olivereanderson olivereanderson merged commit 6a5d86b into dev Dec 9, 2021
@olivereanderson olivereanderson deleted the chore/migrate-to-time branch December 9, 2021 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking change A change to the API that requires a major release. Part of "Changed" section in changelog Rust Related to the core Rust code. Becomes part of the Rust changelog. Wasm Related to Wasm bindings. Becomes part of the Wasm changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants