Also fix a couple of possible overflows while at it. Fixes the negative initial timestamps in ticket #10358. Signed-off-by: Marton Balint <cus@passwd.hu>