This can be applied to just about anything; none of us know how long it will take us to get something done.
This is especially true with writing software but lets think about an everyday task, shall we? What about washing the dishes? How long is it going to take you to wash the dishes the next time you decide to do that oft procrastinated task? Five minutes? Ten? Two hours? The truth is, you don't know. You might count the number dishes, say 10 dishes, and think it will take you about 5 minutes (or 30 seconds per dish) to wash, dry, and put them all away. But, how dirty are these dishes? Is one a burnt pan? Do you have the right soap or tool to do the job? What if you find that, while you're washing a pot, that the pot's handle is loose? Do you fix it right then or wait till next time? If you fix it right then how long will that take?
You see where I'm going? Estimating the amount of time it will take to complete a task is - well, I'll just say it - impossible. But we try. We try to calculate all of the possibilities, rule in error, and even give ourselves some padding in the estimate to lower expectations and over deliver. But we almost always fail. Sometimes miserably. The difficult part is coming to grips with that and embracing it.
In my entire life I've never been 100% accurate on estimating time. I'm forever an optimist and because of that I'm almost always late at getting something done because I always think it will take less time to finish something than it really will. I think in rose pedals and rainbows.
One quick example to beat this horse until bloody. Recently I was playing around with a pet project of mine and I wanted to add Twitter's authentication tools to it. In short, this allows people to use their Twitter credentials to log into my application. Should be relatively straight forward, right? Well, ever the optimist and being smart and efficient I grabbed an open source library that claimed to do exactly what I needed. I thought, foolishly, that I'd simply plug the library into my application, follow the setup instructions and I'd move on in less than 30 minutes. It works this way sometimes but not very often. Suffice to say it didn't work like this for me. In fact, I still haven't finished hours later. Hours. Something I thought would take me less than 20 minutes and I have now spent hours trying to get it to work properly. And guess what? I've decided to scrap it. Hours and hours wasted only to figure out that I'd have been better off building this myself. And now it will take me a few hours to do just that (or much longer).
I'll never learn. I'm freely admitting that right now. I'd rather be an optimist than be the person that thinks that everything they ever want to do will take too long, be too hard, and will ultimately not be possible to achieve and thus; never try. I'm going to continue to try and continue to fail but - every once and while - I'll succeed (although later than I would have thought) and be happy.