Did you mean Serial1.peek()? I don't think that ever returns 0. If the buffer is empty I would expect it to return -1 (like Seria1.read() would).
I think you meant:
uint8_t timedRead() {
uint32_t prev_millis = millis();
do {
if (Serial1.available() != 0) return read();
} while (millis() - prev_millis < time_out);
return 0; // indicates timeout
}
That does basically what I wrote except the caller has to check after every call to timedRead() to see if there was a timeout (returns 0) or not.