These values can then be read into an array/vector, separating year, month, day and time (somehow...). Now, what I want is the difference between successive time intervals (in seconds) for a calculation, i.e. t2 - t1, t3 - t1 and so on. This presents two problems:
1) How could time (in the form of HH:SS above) be represented in the array, so that they can be subtracted?
2) If the clock transitions from a 50-something to a "single digit" the difference is a huge negative number. (eg. 05 - 59 = -54). What now?
Hmm i haven't leanrt anything about file I/O yet so sorry if this is a bit shady but could you not read the line till you get a ':' and take the two values before and after the ':'? And then you could have two parallel arrays so that the HH and SS correspond with eachother e.g. arrayHH[0] goes with arraySS[0].
Boost.Date_Time will parse date/time strings into date & time objects and calculate differences. It handles all the fun leap-year magic so you don't have to. Of course this won't help you if it's a school assignment. If you are on Unix/Linux, strptime() will parse the date and time. It's the inverse of strftime(). It is not available on Windows.
The problem is typically solved by converting everything to and from seconds. There may be limits on the number of seconds you can count.
Thanks for the advice. Although it would be possible to put the time into 2 separate arrays, how would this help? PanGalactic, I'm not familiar with parsing yet, although I have heard of it. The project is an assignment and the time difference is always in the range of 6-7s. Is there any easier way to solve this problem? I still feel pretty much totally lost on this one.