diff --git a/datetime/datetime.go b/datetime/datetime.go index ebb92bc..60ae892 100644 --- a/datetime/datetime.go +++ b/datetime/datetime.go @@ -75,8 +75,12 @@ func (dt datetime) add(y, m, d, h, i int, e ...int) datetime { p, v = PrecisionMillisecond, v+e[1] } } - dc := v / MillisecondPerDay - d, v = d+dc, v-dc*MillisecondPerDay + d += v / MillisecondPerDay + v %= MillisecondPerDay + if v < 0 { + d-- + v += MillisecondPerDay + } return newDT(dt.date.add(y, m, d), newC(uint(v), p)) } func (dt datetime) addT(y, m, d int) datetime { return newDT(dt.date.add(y, m, d), dt.clock) } diff --git a/go.mod b/go.mod index 184b15e..f0b8f27 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ module gitea.zaclys.com/bvaudour/gob -go 1.21 +go 1.22 -require golang.org/x/crypto v0.13.0 +require golang.org/x/crypto v0.19.0 diff --git a/go.sum b/go.sum index 8886ba7..b3dc059 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,2 @@ -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=