How can I calculate how long it took a transaction to be confirmed?
Unfortunately, at least for bitcoin and litecoin (and likely most bitcoin derivative block chains), the only way to get this information is to have a node/client listening at the time the transaction appears on the network.

Otherwise your client will simply use the block's timestamp for each transaction. 

This design means that getting this information is only possible if using a third party who was maintaining a copy of the blockchain at that time, or potentially getting a dump of a trusted source's blockchain which should (I believe, although I haven't tested it myself) maintain the original client's timestamps. 

Would be great if someone could confirm this. I will myself if I get the chance to test it but that might not happen any time soon.