How long for the caffeine from a typical cup of coffee to leave the system?

If I have one cup of coffee all day - How long roughly will it take for the effects of the caffeine on my alertness to be zero?
If I’ve had double the dose of caffeine in that cup - how does that effect the timescale (does it double the amount of time before the effect is zero? Or does it make no difference? Or somewhere inbetween)

Biology Articles - Biology Articles, Tutorials & Dictionary Online

I saw recently in a tv ad for an OTC sleep aid that caffeine ingested after 2 p.m. can affect your sleep. I switched from a caffeinated tes to no-caf one for my evening relaxer and I’ve slept right thru most of the time since then. No cite.