If the image does not remain on screen for a duration longer than five miliseconds, we should further decrease the refresh rate.

Are there any mistakes in this sentence, especially the indefinite article before 'duration'?

Thanks in advance!
N2G, it's a very difficult sentence to understand because of all the negatives. If it doesn't... for longer than.

I would have to really work hard to understand it: Okay, it was 6 ms. That's longer than 5. So it did remain longer than 5, so I met the first condition. So therefore, I don't need to...

Try writing it like this: Decrease the refresh rate if the image remains on the screen less than 5 milliseconds.
«If the image doesn't remain on _the_screen for a duration longer than...»

"a duration" is the only correct alternative here (neither "the" nor zero article will work here).

You could also say: "If the image does not remain on the screen longer than" to make the sentence less wordy.
 BarbaraPA's reply was promoted to an answer.