Clean up timestamp calculation.