220V detector - again

Mm, not really. IF you think of it as sampling then you would at least need the Nyquist frequency. And you might say the second sample is the middle but that's as far as it has anything to do with the middle.

But you may assume the Arduino is orders of magnitude faster than mains. Aka, timing of the polling or sampling isn't really an issue. And to make it accurate, just use the interrupt on state change. Now you just have two events for a puls, a rising event and a falling event. And you can just apply the usual time keeping practices (hint: millis() / micros()) to determine z and y.