Hi, probably an easy solution but it’s eluding me.
I have an object array that is essentially lines in a log filtered where one property is the timestamp of the log event and the other is the actual log event message. The timestamps are cast as DateTime. I want to do a TimeSpan of each pair of objects in the array, and have that TimeSpan stored as an additional property in the array.
Take example object array:
PS C:\Users\igarvin> $data
Timestamp Timespan Message --------- -------- ------- 8/1/2015 5:09:34 PM Starting to sync... 8/1/2015 5:11:41 PM Synchronization complete. 8/2/2015 12:23:43 AM Starting to sync... 8/2/2015 12:25:15 AM Synchronization complete.
I want a timespan property to record the timespan between the sync start and sync complete events. I’m just confused how to grab the results of two objects in an array, compare, and then stuff results back into one of the objects, and to iterate this process. Much googling doesn’t show up anything which is odd as I would assume implementing something that would get timespans for log events would be desirable. Any ideas on this?