range query with timestamp correction