duration icon indicating copy to clipboard operation
duration copied to clipboard

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

Open nitram509 opened this issue 1 year ago • 0 comments

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.

nitram509 avatar Sep 13 '22 21:09 nitram509