Ask your own question, for FREE!
Computer Science 20 Online
OpenStudy (mike2):

Write a function elapsed_time that takes as its arguments two time structures and returns a time structure that represents the elapsed time (in hours, minutes, and seconds) between the two times. So the call elapsed_time (time1, time2) where time1 represents 3:45:15 and time2 represents 9:44:03, should return a time structure that represents 5 hours, 58 minutes, and 48 seconds. Be careful with times that cross midnight.

OpenStudy (mike2):

This question was asked before but there was no answer for it and I can't figure it out.

OpenStudy (rsmith6559):

Dealing with times in this way is a waste of effort. Computers hold times as a signed integer which is an offset from the epoch (Jan 1, 1970 00:00:00 UTC). This allows time differences to be handled as simple subtraction.

OpenStudy (bibby):

I always dislike comments like these. There's a clear objective to be obtained here. It doesn't matter how impractical the practice is, whoever is in charge probably wants it done that way. It's certainly advice, it's just irritating to see all the time.

OpenStudy (e.mccormick):

I too hate seeing those sorts of replies. They are violations of the Be Nice rule in in the code of conduct. Here is a much better reply: Well, how far did you get with the time structures? What did you try and where did it have trouble? The reason that is much better is because I am not doing the homework of the asker for them. At the same time, I am encouraging them to participate. If you want to argue over the quality of a question, try Stack Overflow. They have lots of that in the comments.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!