The correct option is D by
Option D: 'By' means 'according to'. It completes the sentence in meaning: It is midnight according to the church clock.
Hence option D is correct.
Option A: 'With' means 'accompanied by'. It does not complete the sentence in meaning. (midnight with the church clock)
Option B: 'At' refers to a time or place: at 4 p.m., at the movies. This word does not give the required meaning to the sentence, the 'church clock' is not a place.
Option C: 'In' means 'enclosed by walls' or 'inside a container'.
This word, too, does not form a complete thought over here.
Hence options A, B and C are incorrect.