By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,117 Members | 1,093 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,117 IT Pros & Developers. It's quick & easy.

time in and out difference in c++ using the the normal time with the military time (i

P: 1
guys for example it's like:
time in:
10:00
time out:
12:30
time used: 2.5 hours
Dec 8 '16 #1
Share this Question
Share on Google+
2 Replies


weaknessforcats
Expert Mod 5K+
P: 9,197
Convert your start and end times to an integer. Then just subtract the integers to get the elapsed time. Finally write a function that takes an int as an argument and displays the value in that int as a time in the correct format.
Dec 9 '16 #2

Expert 100+
P: 2,398
Convert your start and end times to an integer in whatever finest-resolution time unit you're using -- apparently that is minutes.

Is your program required to support a start time on one day and an end time on another day?

Is your program required to properly handle a transition between standard and daylight savings time within the interval?
Dec 9 '16 #3

Post your reply

Sign in to post your reply or Sign up for a free account.