Organisms are adapted to the relentless cycles of day and night, because they evolved timekeeping systems called circadian clocks, which regulate biological activities with ~24-h rhythms. The clock of cyanobacteria is driven by a three-protein oscillator comprised of KaiA, KaiB, and KaiC, which together generate a circadian rhythm of KaiC phosphorylation. We show that KaiB flips between two distinct three-dimensional folds, and its rare transition to an active state provides a time delay that is required to match the timing of the oscillator to that of earth’s rotation. Once KaiB switches folds, it binds phosphorylated KaiC and captures KaiA, initiating a phase transition of the circadian cycle, and regulates components of the clock-output pathway, providing the link that joins the timekeeping and signaling functions of the oscillator.