There was a thread about this a while ago. I was interested in coding an addon like this, so I did. But the time it takes for your character to leave combat is very very random. In theory, it's 5 seconds. In reality, it can be anywhere from 4.5 - 7 seconds, just because responses from the server aren't always on time.
I'm just going to copy and paste my post I left in the last thread to explain it:
I've spent a little while rewriting this. It seems very inaccurate. The time it takes a player to go out of combat seems to vary, anywhere from 4.5 to 7 seconds. There is nothing wrong with the addon. The wow client/server just seems to act a bit random when it comes to dropping combat. The most accurate I've had it is by setting the ooc timer to 6 seconds (yes, in theory it is 5 seconds). It's still not correct, but it can give a somewhat decent estimate as to when you'll be dropping combat.