I'm trying to find the duration of an event in high (1) state. The states are logged into a table as the following
time |state|
------- +-----+
01:00:00| 0|
01:01:00| 1|
01:02:35| 1|
01:03:20| 0|
01:04:00| 0|
01:05:00| 0|
01:06:00| 1|
01:07:00| 1|
01:08:00| 1|
01:09:10| 0|
01:10:00| 0|
01:11:00| 1|
01:12:45| 0|
The result I'm looking for is this:
starttime | endtime | duration |
-------------+------------+-------------+
01:01:00 | 01:03:20 | 00:02:20 |
01:06:00 | 01:09:10 | 00:03:10 |
01:11:00 | 01:12:45 | 00:01:45 |
Almost the same as this post, but not quite the same
not quite sure how to acomplish this.. any help would be appreciated