turntable/utils.py
def displayAll(elapsed, display_amt, est_end, nLoops, count, numPrints):
    '''Displays time if verbose is true and count is within the display amount'''

    if numPrints > nLoops:
        display_amt = 1
    else:
        display_amt = round(nLoops / numPrints)

    if count % display_amt == 0:

        avg = elapsed / count
        est_end = round(avg * nLoops)

        (disp_elapsed,
         disp_avg,
         disp_est) = timeUnit(int(round(elapsed)),
                              int(round(avg)),
                              int(round(est_end)))

        print "%s%%" % str(round(count / float(nLoops) * 100)), "@" + str(count),

        totalTime = disp_est[0]
        unit = disp_est[1]

        if str(unit) == "secs":
            remain = totalTime - round(elapsed)
            remainUnit = "secs"
        elif str(unit) == "mins":
            remain = totalTime - round(elapsed) / 60
            remainUnit = "mins"
        elif str(unit) == "hr":
            remain = totalTime - round(elapsed) / 3600
            remainUnit = "hr"

        print "ETA: %s %s" % (str(remain), remainUnit)
        print

    return
def displayAll(elapsed, display_amt, est_end, nLoops, count, numPrints):
    '''Displays time if verbose is true and count is within the display amount'''

    if numPrints > nLoops:
        display_amt = 1
    else:
        display_amt = round(nLoops / numPrints)

    if count % display_amt == 0:

        avg = elapsed / count
        est_end = round(avg * nLoops)

        (disp_elapsed,
         disp_avg,
         disp_est) = timeUnit(int(round(elapsed)),
                              int(round(avg)),
                              int(round(est_end)))

        print "%s%%" % str(round(count / float(nLoops) * 100)), "@" + str(count),

        totalTime = disp_est[0]
        unit = disp_est[1]

        if str(unit) == "secs":
            remain = totalTime - round(elapsed)
            remainUnit = "secs"
        elif str(unit) == "mins":
            remain = totalTime - round(elapsed) / 60
            remainUnit = "mins"
        elif str(unit) == "hr":
            remain = totalTime - round(elapsed) / 3600
            remainUnit = "hr"

        print "ETA: %s %s" % (str(remain), remainUnit)
        print

    return
Displays time if verbose is true and count is within the display amount