Skip to content

Conversation

@mamcx
Copy link
Contributor

@mamcx mamcx commented Jan 18, 2024

Description of Changes

To make it possible to integrate spacetimedb::Timestamp with chrono, I add a way to convert into/from micros_since_epoch:u64

Expected complexity level and risk

1

@mamcx mamcx requested a review from coolreader18 January 18, 2024 14:52
Copy link
Collaborator

@joshua-spacetime joshua-spacetime left a comment

Choose a reason for hiding this comment

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

Any reason not to prefer From<Timestamp> for u64?

@mamcx
Copy link
Contributor Author

mamcx commented Jan 18, 2024

Any reason not to prefer From<Timestamp> for u64?

Mainly for the semantics (so is clear wich unit is used here)

@mamcx mamcx added this pull request to the merge queue Jan 18, 2024
Merged via the queue into master with commit ffd22de Jan 18, 2024
@gefjon
Copy link
Contributor

gefjon commented Jan 18, 2024

Any reason not to prefer From<Timestamp> for u64?

Agreed w/ Mario; Timestamp::from(n) could do any number of different things, e.g. treat as seconds, millis, micros or nanos, and doesn't necessarily refer to an offset from the UNIX epoch (e.g. Rust's std::time::Instant is not), but Timestamp::from_micros_since_epoch says exactly what it does.

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.

4 participants