"When you go from night to day [in consecutive days, you're usually] playing a different opponent", said Federer, who couldn't remember the last time he had played a match that was interrupted overnight.
Federer, who already has two titles in 2018 after victories in Australia and Rotterdam, took the first set 6-3 against Argentina's Federico Delbonis in just under 40 minutes.
Daniel faced break points in the opening game of the decider but he brushed them away and it was the 25-year-old who then broke to open up a 4-1 lead and never looked back, handing Djokovic his first opening round defeat at a Masters 1000 tournament since Monte Carlo 2016.
Federer is making his 17th appearance in the California desert and is assured of remaining world number one if he makes it to the semi-finals.
But he went down 7-6 (7-3) 4-6 6-1 to the Japanese qualifier in the second-round match, leaving the 30-year-old to lament a disjointed performance.
In the next round he faces Jeremy Chardy, who beat fellow Frenchman Adrian Mannarino 7-5, 4-6, 6-1.
'It's probably the stat that I'm most proud about in my tennis career, ' he said. "I'm glad I get the chance to play while she" still playing". "He's only going to get better from here", concluded the world number one. "I served well, and I think I played better than I expect before the match".
Federer said he understands well how even a champion like Djokovic could be struggling to find his game so soon after having surgery.
Kasatkina has beaten all four of the current Grand Slam champions in the past year: French Open victor Jelena Ostapenko, Australian Open victor Caroline Wozniacki, Wimbledon victor Garbine Muguruza and now Stephens. "So I'm very happy how things are turning out to be".
In their only other ATP meeting in 2013, Delbonis won on clay in Hamburg 7-6 (9/7), 7-6 (7/4).
Likewise, 23rd-seeded Hyeon Chung of South Korea dispatched 12th-seeded Tomas Berdych of Czech Republic 6-4, 6-4, despite 12 aces against just one double fault from Berdych.
Caroline Garcia also progressed in straight sets against Daria Gavrilova.