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

time-related helpers #33

Open
srenatus opened this issue Dec 18, 2019 · 0 comments
Open

time-related helpers #33

srenatus opened this issue Dec 18, 2019 · 0 comments

Comments

@srenatus
Copy link

Repeatedly, the handling of time and date using nanoseconds has gotten people stumbling.

The situation could perhaps be improved if we had some rego-only helper methods? I'm imaging something like

days(n) = x {
  x := n * hours(24)
}

hours(n) = x {
  x := n * minutes(60)
}

minutes(n) = x {
  x := n * seconds(60)
}

seconds(n) = x {
  x := n * 1000000000
}

So that you could write time.now_ns() - time.days(1) etc.

This would be similar to how golang does it in time's constants.

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

No branches or pull requests

1 participant