The difference between me being productive and happy versus unproductive and unmotivated pretty much comes down to how much sleep I get. The difference is night and day (excuse any sleep pun).
If I am asleep before midnight and sleep straight through till 7am, I am a dynamo all day.
If it's 1am and I am up at 6 am (newborn, nursing, sick kids, insomnia...name your reason) then I eat badly (I target greasy and salty foods, I have no idea why) and am not a happy person. Everything moves more slowly, my motivation is terrible and I feel down.