Spending a lot of time doing something doesn't mean that you've accomplished anything useful.
This is a hard one to swallow, but it's true.
I've often spent hours writing hundreds of lines of code, only to realize that all I've done is actually made things worse.
Sometimes you need to go back to square one and delve into the root of what you're trying to accomplish.
The problem might be easier than you initially thought.
Are you doing something better suited to a computer? Automate it!
Don't just keep plodding away like a machine. Think carefully about what you're doing, and how you can do it more efficiently.