Fix expiry time calculation