That’s because of d.TotalSecond is converted into Int32 before doing modulo operation. The conversion causes integer overflow. So, the result obviously would be wrong.
dim d as new Date
dim tsd as Double = d.TotalSeconds
dim tsu as UInt64 = tsd
dim tsi as Int64 = tsd
dim tsi32 as Int32 = tsd
MsgBox Str(tsd mod 60)
MsgBox Str(tsu mod 60)
MsgBox Str(tsi mod 60)
MsgBox Str(tsi32 mod 60)