Skip to content

Conversation

@wes-sleeman
Copy link
Contributor

@wes-sleeman wes-sleeman commented May 22, 2025

Description of Changes

This change adds the following System.TimeSpan-style static construction methods to SpacetimeDB.TimeDuration:

  • static TimeDuration FromMilliseconds(double milliseconds)
  • static TimeDuration FromSeconds(double seconds)
  • static TimeDuration FromMinutes(double minutes)
  • static TimeDuration FromHours(double hours)
  • static TimeDuration FromDays(double days)

These mirror the equivalently named static methods on System.TimeSpan and dramatically improve usability and familiarity for experienced C# users with no more overhead than the user performing the multiplication themselves.

Wish I'd thought to do this before v1.1.2 got released. Ah well.

API and ABI breaking changes

None. Convenience methods added in bindings only.

Expected complexity level and risk

1 (potentially up to a low 2 if cleanup is desired elsewhere in the bindings to leverage these new methods).

Testing

  • Ensure the changes build.
  • New contributor check! Review to make sure repo style & substance standards are complied with.

@CLAassistant
Copy link

CLAassistant commented May 22, 2025

CLA assistant check
All committers have signed the CLA.

@bfops bfops requested a review from kazimuth May 23, 2025 15:29
@bfops
Copy link
Collaborator

bfops commented May 27, 2025

Thank you for submitting this! We'll work on getting it reviewed soon.

@wes-sleeman
Copy link
Contributor Author

Thanks! Feel free to merge as-is if you have no problems with it on review. Also very happy to add the equivalent construction helper methods to the Timestamp class (based on the ones in System.DateTime) if that would be helpful? I can do it in this PR or just file a second one…

@wes-sleeman
Copy link
Contributor Author

Hello! Just wanted to bump this as it's been a couple months now on what seems like a fairly minor edit. :)

@bfops bfops requested review from rekhoff and removed request for kazimuth August 1, 2025 19:21
Copy link
Contributor

@rekhoff rekhoff left a comment

Choose a reason for hiding this comment

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

These changes look reasonable and and clear.

@bfops
Copy link
Collaborator

bfops commented Aug 15, 2025

I'm going to force-merge this since the only CI checks that haven't run/passed are from the public repos that we merged in. This PR is from before we merged them, so it can't mess them up.

@bfops bfops merged commit e715c80 into clockworklabs:master Aug 15, 2025
14 of 15 checks passed
@wes-sleeman wes-sleeman deleted the wes/timeduration-constructors branch August 31, 2025 03:16
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