I have a table with devices logs and I need calculate the working time and stopped time, how making in sql?

The sample log table:

device1 0 11-03-2011 15:00
device1 1 11-03-2011 14:00
device1 0 11-03-2011 13:00
device1 1 11-03-2011 12:00
device1 0 11-03-2011 11:00
device1 1 11-03-2011 10:00
device2 0 11-03-2011 15:00
device2 1 11-03-2011 14:00
device2 0 11-03-2011 13:00
device2 1 11-03-2011 12:00
device2 0 11-03-2011 11:00
device2 1 11-03-2011 10:00

Thanks,

All regards,

Nuno