A straightforward approach would be to declare and initialize time counter before sending a request and after reading its response and then subtracting one from another. This difference will represent the response time.