calculate first time after messages are sorted