Actually studies suggest that for "knowledge workers" like programmers 25 minutes is the average amount of time it takes to recover from an interruption to a task. So half an hour lost to an interruption isn't that bad an estimate. Anecdotally I've certainly had times deep into debugging complex problems where an interruption has needed a lot longer than 30 minutes to recover from.
This. I find I can generally get back into feature writing within 5-10 minutes. Debugging can take much longer. This is the number one reason for staying late, because I know that if I leave this issue now, it will take me half of tomorrow just to get back to this particular spot.