Evolution of competing populations in time-varying environments