import time


def write_generator_lines(conctimes, concaz, concel, concva, concve, az_flags, el_flags):
    """
    Produces a list of lines in the format necessary to upload to the ACU to complete a 
    generated scan. Params are the outputs of generate.

    Params:
        conctimes (list): List of times starting at most recently used time for the ACU 
                          to reach associated positions
        concaz (list): List of azimuth positions associated with times
        concel (list): List of elevation positions associated with times
        concva (list): List of azimuth velocities associated with times
        concve (list): List of elevation velocities associated with times
        az_flags (list): List of flags associated with azimuth motions at associated times
        el_flags (list): List of flags associated with elevation motions at associated times
    """
    fmt = '%j, %H:%M:%S'
    start_time = 10.
    true_times = [start_time + i for i in conctimes]
    fmt_times = [time.strftime(fmt, time.gmtime(t)) + ('%.6f' % (t%1.))[1:] for t in true_times]

    all_lines = [('%s;%.4f;%.4f;%.4f;%.4f;%i;%i\r\n' % (fmt_times[n], concaz[n], concel[n], concva[n], concve[n], az_flags[n], el_flags[n])) for n in range(len(fmt_times))]
    return all_lines