I have a pattern from low to high. When it spikes high i need to record the time it is high and that will tell me if its a "0" or a "1" then it will dip to low and i need to write this so that it will detect and time the time in ms.
When it dips low it will then go high for an x amount of ms and that will be a "0" or "1".
When it spikes high i need to record the time it is high
I interpret that as when it the input becomes HIGH then you need to record the time then later, when it becomes LOW you need to record the time again so that you can use the difference to determine whether the pulse represented a 0 or a 1. Is that right ?
Note my use of becomes rather than is. If I am correct then you need to detect the state change times. Have a look at the StateChangeDetection example in the IDE
If you mean something different then please explain in more detail