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 convenience truncate method to Timestamp type #1607

Open
wants to merge 1 commit into
base: series/0.18
Choose a base branch
from

Conversation

ghostbuster91
Copy link
Contributor

This closes #1598

PR Checklist (not all items are relevant to all PRs)

  • Added unit-tests (for runtime code)
  • Added bootstrapped code + smoke tests (when the rendering logic is modified)
  • Added build-plugins integration tests (when reflection loading is required at codegen-time)
  • Added alloy compliance tests (when simpleRestJson protocol behaviour is expanded/updated)
  • Updated dynamic module to match generated-code behaviour
  • Added documentation
  • Updated changelog

@kubukoz kubukoz changed the title Add convince truncate method to Timestamp type Add convenience truncate method to Timestamp type Oct 7, 2024
/**
* @return a copy of this timestamp with a milisecond resolution
*/
def truncateNanos: Timestamp = copy(nano = (nano / 1000000) * 1000000)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm finding the naming pretty confusing. I think it should be truncateToSeconds and truncateToMillis to make it clearer. For instance truncateToSeconds would truncate anything more precise than seconds.

Copy link
Contributor

Choose a reason for hiding this comment

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

Alternatively : toSecondPrecision and toMillsecondPrecision ?

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.

Decrease timestamp resolution
2 participants