I'm debouncing in a 10ms timer IRQ
Using Peter D's code...
I've been meaning to mention the Danni/Dannegger debounce myself. It was developed for AVR, but there's no reason why the algorithm couldn't be used on any hardware with some sort of periodic housekeeping interrupt where the switch inputs can be sampled. I usually have one running at 1mSec or 5mSec intervals. Crazy efficient; the code supports 8 inputs with the same processing cycles as one input.
There's not much to the code but it can hard to understand, and sometimes I wish for more than 4 matching states in the vertical adder before change of state is detected. But it usually works pretty good except on my crappiest switches. Gurus and moderators in the AVRFreaks forum have a heyday blasting any other scheme.