I want to print the time on the serial monitor at the start and end of a signal (Help)

X=1 is an assignment. X==1 is a comparison. Putting an assignment in a loop condition doesn't make sense. Indeed, a comparison in a loop conditional makes no sense unless you change the condition within the loop.

I have no idea what you mean by "iterative loop is in conflict with the void loop function".