Fix bug in sorting threads (timestamp difference cast from long to int
out of range).