The sketch has no idea how the board is powered. Your code will not run any differently on USB power vs. external power.
How do you know the code is not running? The posted code changes output once after 12 hours and then never changes output again. Assuming that setting pin 8 high turns the water on and setting it low turns the water off, you never turn the water off once it is on.