We present a study in the evolution of temporal behavior, specifically synchronization and desynchronization, through digital evolution and group selection. In digital evolution, a population of self-replicating computer programs exists in a user-defined computational environment and is subject to instruction-level mutations and natural selection. Group selection links the survival of the individual to the survival of its group, thus encouraging cooperation. Previous approaches to engineering synchronization and desynchronization algorithms have taken inspiration from nature: In the well-known firefly model, the only form of communication between agents is in the form of flash messages among neighbors. Here we demonstrate that populations of digital organisms, provided with a similar mechanism and minimal information about their environment, are capable of evolving algorithms for synchronization and desynchronization, and that the evolved behaviors are robust to message loss. We further describe how the evolved behavior for synchronization mimics that of the well-known Ermentrout model for firefly synchronization in biology. In addition to discovering self-organizing behaviors for distributed computing systems, this result indicates that digital evolution may be used to further our understanding of synchronization in biology.