Really difficult thing in the software craftsmanship: estimations. And there is a simple (I think well-known) solution of the problem:
"The worst case scenario occurs when you continue to tell everyone, up to the very end, that you will be on time—and then let them all down. Don’t do this. Instead, regularly measure your progress against your goal, and come up with three fact-based end dates: best case, nominal case, and worst case. Be as honest as you can about all three dates. Do not incorporate hope into your estimates! Present all three numbers to your team and stakeholders. Update these numbers daily."
Quote is from the Clean Coder book created by Uncle Bob. If you have a time, be sure to read this book 🙂