A thought I keep coming back to:
If programming is a large part of your life (professionally or not), then it's remarkably difficult to completely waste your time while programming.
It often _feels_ like it, whenever you didn't solve the immediate problem. But skill is your most important resource, and every line you write trains and builds skill.
Even code you shouldn't have written, or that reviewers hate, or that doesn't work.
Sometimes it's _only_ practice – but that's still not nothing!