fix timeext under 32bit compilation

This commit is contained in:
Mike Schwörer 2022-10-29 15:11:08 +02:00
parent f5243503db
commit 07712aa08c
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF

View File

@ -84,7 +84,7 @@ func IsDatePartEqual(a time.Time, b time.Time, tz *time.Location) bool {
func WithTimePart(base time.Time, hour, minute, second int) time.Time {
datepart := TimeToDatePart(base, base.Location())
delta := time.Duration(hour*int(time.Hour) + minute*int(time.Minute) + second*int(time.Second))
delta := time.Duration(int64(hour)*int64(time.Hour) + int64(minute)*int64(time.Minute) + int64(second)*int64(time.Second))
return datepart.Add(delta)
}
@ -94,7 +94,7 @@ func WithTimePart(base time.Time, hour, minute, second int) time.Time {
func CombineDateAndTime(d time.Time, t time.Time) time.Time {
datepart := TimeToDatePart(d, d.Location())
delta := time.Duration(t.Hour()*int(time.Hour) + t.Minute()*int(time.Minute) + t.Second()*int(time.Second) + t.Nanosecond()*int(time.Nanosecond))
delta := time.Duration(int64(t.Hour())*int64(time.Hour) + int64(t.Minute())*int64(time.Minute) + int64(t.Second())*int64(time.Second) + int64(t.Nanosecond())*int64(time.Nanosecond))
return datepart.Add(delta)
}
@ -108,7 +108,7 @@ func IsSunday(t time.Time, tz *time.Location) bool {
}
func DurationFromTime(hours int, minutes int, seconds int) time.Duration {
return time.Duration(hours*int(time.Hour) + minutes*int(time.Minute) + seconds*int(time.Second))
return time.Duration(int64(hours)*int64(time.Hour) + int64(minutes)*int64(time.Minute) + int64(seconds)*int64(time.Second))
}
func Min(a time.Time, b time.Time) time.Time {