A defining feature of circadian rhythms is an internal oscillator that is self-sustaining in constant conditions, but the utility of this free-running property is not clear.In cyanobacteria, two alternative timing systems are found: a canonical circadian clock and an hourglass-like system incapable of free-running.By swapping genetic elements, we engineer a pathway to convert a circadian clock into an hourglass. We show that the performance of these systems is similar in a balanced light-dark cycle, but the hourglass shows dysregulated transcription in long photoperiod days and fails to provide resistance to midday UV exposure. A minimal mathematical model shows that inability to adapt to a changing photoperiod is a generic limitation of these hourglass systems that free-running clocks can overcome. We conclude that the ability to occupy niches far from the equator, where daylength is highly variable, demands a self-sustaining circadian rhythm, consistent with the observed geographical range of cyanobacterial species.Our work establishes a genetic model system to study how environmental pressures led to the evolution of circadian rhythms. 1 2 3