I have a list:
List<DateTime> timeStamp;
Lets say that the list contains the following DateTimes:
2006-09-07 11:46:09
2006-09-07 11:46:19
2006-09-07 11:46:20
2006-09-07 11:46:36
2006-09-07 11:47:49
2006-09-07 11:47:53
2006-09-07 11:48:02
2006-09-07 11:48:15
2006-09-07 11:48:29
2006-09-07 11:48:34
2006-09-07 11:54:29
2006-09-07 11:54:39
2006-09-07 11:54:49
2006-09-07 11:54:59
2006-09-07 11:56:19
2006-09-07 11:56:29
2006-09-07 11:56:39
2006-09-07 11:58:29
2006-09-07 11:58:34
2006-09-07 11:58:45
2006-09-07 11:58:53
2006-09-07 12:00:29
2006-09-07 12:00:39
2006-09-07 12:00:45
2006-09-07 12:00:54
2006-09-07 12:01:03
Now, I want to calculate the total accumulated time. All of these times are in the same List, and the gaps represent a stop/start section. I also have no control over the interval of the timestamp. It could be 10 seconds, it could be 1 minute. Thanks for any and all help!
Here’s a new answer if you can define the length of the gap:
This works by zipping the list against itself so that entries that were next to each other are available for selection (ie the list is selected ‘pairwise’). Timespans are calculated from these, and large timespans (ie that intervals you want ignored) are filtered out.