Largely ditto Walter. But two more things:
One: If you ask, "Do you have the time?" by itself, it means, "What time is it?" But if you've just described some assistance that you need or job that has to be done, it can mean, "Are you available to do this?" For example, "Someone is going to have to proof-read this report. Bob, do you have the time?"
Two: When asked with the meaning of, "What time is it?", it is phrased as a yes/no question, but the expected answer is to tell the person the time. That is: "Bob, do you have the time?" "It's 9:30." Or if you don't know, then to say, "Sorry, I don't know." Every now and then someone thinks he's being very funny when we answers with a literal, "Yes, I do" and then walks away. It's the sort of gag that was no doubt very funny the first time someone did it, but has long since lost it's humor value. Similarly, we often ask questions like, "Do you know Sally's email address?" when we really mean, "What is Sally's email address?" Etc. Generally we phrase a question that way when we think it is likely that the person doesn't know, so it's really shorthand for, "Do you know X, and if so, will you please tell me X?" Don't answer "yes" and leave it at that. It's an idiom, we know what the person really means by the question, don't take it literally.