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.
1Indeed, "Do you have a time?" is not generally a standalone question. That said, the phrase "do you have a time" could be used in a few contexts. For example: Do you have a time when you want to meet? or, Do you have a time when you check ELL every day? – J.R. – 2013-07-12T08:55:50.123
1Excellent point @J.R. I didn't think about it as a phrase within a larger question. I will edit to address this. – Walter – 2013-07-12T12:22:58.737
1There is also the exclamation, "We had a time!" meaning "We had a lot of fun" or "We did something exciting." But I've never heard someone ask, "Did you have a time?" to mean "Did you have fun?" – Jay – 2013-07-12T13:24:51.233
Lately I have been asked do you have a time by an Aussie, when I was walking past him. – user31782 – 2017-12-02T01:29:27.170