time query code