MTBF comes from hardware reliability engineering and counts operating time, not calendar time: the time spent down for repair is left out. For software services it is a way to say how often incidents happen.
MTBF and MTTR together set availability. A system that fails rarely but takes long to restore can have the same uptime as one that fails often and recovers in minutes; users usually prefer the second, since short outages disrupt less.
MTTF, mean time to failure, is used instead for parts that are replaced rather than repaired, such as disks.
Formula
MTBF = total operating time ÷ number of failures; availability = MTBF ÷ (MTBF + MTTR)
Example:
A 30-day month (720 hours) with 3 outages totalling 1 hour: MTBF = 719 ÷ 3 ≈ 240 hours. With an MTTR of 20 minutes, availability is 240 ÷ (240 + 0.33) ≈ 99.86%.