Text to show in time_label.
326612
def show_time(self, end=False):
        """"""
        if self.time_label is None:
            return

        elapsed_time = time.monotonic() - self.t0
        # System time changed to past date, so reset start.
        if elapsed_time < 0:
            self.t0 = time.monotonic()
            elapsed_time = 0
        if elapsed_time > 24 * 3600:  # More than a day...!
            fmt = "%d %H:%M:%S"
        else:
            fmt = "%H:%M:%S"
        if end:
            color = "#AAAAAA"
        else:
            color = "#AA6655"
        text = "<span style=\'color: %s\'><b>%s" \
               "</b></span>" % (color,
                                time.strftime(fmt, time.gmtime(elapsed_time)))
        self.time_label.setText(text)
95032
def time_ago(options: {})
      data = { behavior: "tooltip-on-hover", time_ago: "moment.js" }

      options.reverse_merge!(title: created_updated_tooltip_text, data: data)

      time_tag(options: options)
    end
762126
def _field_value_text(self, field):
        """"""
        if field in self.fields:
            return unicode(self.get(field))
        else:
            return self.get_timemachine_instance(field)._object_name_text()
1304358
def _colored_time(self, time_taken, color=None):
        """"""
        if self.timer_no_color:
            return "{0:0.4f}s".format(time_taken)

        return _colorize("{0:0.4f}s".format(time_taken), color)
539492
def QA_util_time_stamp(time_):
    
    if len(str(time_)) == 10:
        # yyyy-mm-dd格式
        return time.mktime(time.strptime(time_, '%Y-%m-%d'))
    elif len(str(time_)) == 16:
        # yyyy-mm-dd hh:mm格式
        return time.mktime(time.strptime(time_, '%Y-%m-%d %H:%M'))
    else:
        timestr = str(time_)[0:19]
        return time.mktime(time.strptime(timestr, '%Y-%m-%d %H:%M:%S'))
187334
def datetime_f(dttm):
    """"""
    if dttm:
        dttm = dttm.isoformat()
        now_iso = datetime.now().isoformat()
        if now_iso[:10] == dttm[:10]:
            dttm = dttm[11:]
        elif now_iso[:4] == dttm[:4]:
            dttm = dttm[5:]
    return '<nobr>{}</nobr>'.format(dttm)
588211
def add_time_labels(self):
        """"""
        for text, pos in zip(self.idx_time, self.time_pos):
            self.scene.addItem(text)
            text.setPos(pos)
205085
def time_label(intvl, return_val=True):
    """"""
    # Monthly labels are 2 digit integers: '01' for jan, '02' for feb, etc.
    if type(intvl) in [list, tuple, np.ndarray] and len(intvl) == 1:
        label = '{:02}'.format(intvl[0])
        value = np.array(intvl)
    elif type(intvl) == int and intvl in range(1, 13):
        label = '{:02}'.format(intvl)
        value = np.array([intvl])
    # Seasonal and annual time labels are short strings.
    else:
        labels = {'jfm': (1, 2, 3),
                  'fma': (2, 3, 4),
                  'mam': (3, 4, 5),
                  'amj': (4, 5, 6),
                  'mjj': (5, 6, 7),
                  'jja': (6,  7,  8),
                  'jas': (7, 8, 9),
                  'aso': (8, 9, 10),
                  'son': (9, 10, 11),
                  'ond': (10, 11, 12),
                  'ndj': (11, 12, 1),
                  'djf': (1, 2, 12),
                  'jjas': (6, 7, 8, 9),
                  'djfm': (12, 1, 2, 3),
                  'ann': range(1, 13)}
        for lbl, vals in labels.items():
            if intvl == lbl or set(intvl) == set(vals):
                label = lbl
                value = np.array(vals)
                break
    if return_val:
        return label, value
    else:
        return label
602776
def pretty(timings, label):
        ''''''
        results = [(sum(values), len(values), key)
            for key, values in timings.items()]
        print(label)
        print('=' * 65)
        print('%20s => %13s | %8s | %13s' % (
            'Command', 'Average', '# Calls', 'Total time'))
        print('-' * 65)
        for total, length, key in sorted(results, reverse=True):
            print('%20s => %10.5f us | %8i | %10i us' % (
                key, float(total) / length, length, total))
685135
def time_string(seconds):
    """"""
    s = int(round(seconds))  # round to nearest second
    h, s = divmod(s, 3600)  # get hours and remainder
    m, s = divmod(s, 60)  # split remainder into minutes and seconds
    return "%2i:%02i:%02i" % (h, m, s)
1343856
def time_to_text(time):
    """"""
    
    if time < 0.001:
        return str(round(time * 1000000)) + " µs"
    elif time < 1:
        return str(round(time * 1000)) + " ms"
    elif time < 60:
        return str(round(time, 1)) + " s"
    else:
        return str(round(time / 60, 1)) + " min"
291358
def pretty_print(self):
        
        return u"%s\t%.3f\t%.3f\t%s" % (
            (self.identifier or u""),
            (self.begin if self.begin is not None else TimeValue("-2.000")),
            (self.end if self.end is not None else TimeValue("-1.000")),
            (self.text or u"")
        )
450430
def info(message, code='INFO'):
    

    now = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    output = now + ' [' + torn.plugins.colors.OKBLUE + \
            code + torn.plugins.colors.ENDC + '] \t' + \
            message
    print(output)
614004
def draw_time_marker(self):
        """"""
        self._time_marker_image = self._canvas_ticks.create_image((2, 16), image=self._time_marker)
        self._time_marker_line = self._timeline.create_line(
            (2, 0, 2, self._timeline.winfo_height()), fill="#016dc9", width=2)
        self._timeline.lift(self._time_marker_line)
        self._timeline.tag_lower("marker")
6251
def tac(label=''):
    

    global _tic

    delta_t = time.time() - _tic

    if label != '':
        print('%s - %3.4f s' % (label, delta_t))
    else:
        print('%3.4f s' % delta_t)
988861
def show(self):
        """"""

        if len(self.text) > self.textwidth:
            label = self.text[0:self.textwidth]
        else:
            label = self.text.rjust(self.textwidth)

        terminalSize = getTerminalSize()
        if terminalSize is None:
            terminalSize = 80
        else:
            terminalSize = terminalSize[1]

        barWidth = terminalSize - self.textwidth - 10

        if self.value is None or self.value < 0:
            pattern = self.twiddle_sequence[
                self.twiddle % len(self.twiddle_sequence)]
            self.twiddle += 1
            barSymbols = (pattern * int(math.ceil(barWidth/3.0)))[0:barWidth]
            progressFractionText = '   . %'
        else:
            progressFraction = float(self.value) / self.max

            nBlocksFrac, nBlocksInt = math.modf(
                max(0.0, min(1.0, progressFraction)) * barWidth)
            nBlocksInt = int(nBlocksInt)

            partialBlock = self.sequence[
                int(math.floor(nBlocksFrac * len(self.sequence)))]

            nBlanks = barWidth - nBlocksInt - 1
            barSymbols = (self.sequence[-1] * nBlocksInt) + partialBlock + \
                (self.sequence[0] * nBlanks)
            barSymbols = barSymbols[:barWidth]
            progressFractionText = ('%.1f%%' % (100*progressFraction)).rjust(6)

        print >>self.fid, '\r\x1B[1m' + label + '\x1B[0m [' + barSymbols + \
            ']' + progressFractionText,
        self.fid.flush()
        self.linefed = False
1036809
def ctime(message=None):
    ""
    t = time.time()
    yield
    if message:
        print message + ":\t",
    print round(time.time() - t, 4), "sec"