Fix timestamp calculations.