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

use int64 type to prevent year 2038 problem on 32bit machines #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nitram509
Copy link

@nitram509 nitram509 commented Sep 13, 2022

motivation

I'm using this duration library in a project and tinkered around with long-running timers/durations.
I see an issue with potential wrong calculations when using seconds in combination with time.Duration builtin object.

https://en.wikipedia.org/wiki/Year_2038_problem

That said, on all 64bit machines, that should not be a problem, since int is compiled as 64bit.

What's the change

This PR introduces a breaking change, by using the type int64 instead of int in the Duration struct.
This is aligned with being compatible with Golang standard runtime using int64 as well.

Also, I took the freedom to add documentation per each field, which eases further the usage, as these single letters are not much self-explanatory.

also being compatible with golang standard runtime using int64 as well
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.

1 participant