Formats the max time record to a days, hours, minutes string
974675
def format_maxtime(self, maxtime):
        
        minutes = maxtime.get("minutes", "0")
        hours = maxtime.get("hours", "0")
        days = maxtime.get("days", "0")
        # days, hours, minutes
        return u"{}: {} {}: {} {}: {}".format(
            _("days"), days, _("hours"), hours, _("minutes"), minutes)
709212
def formatDate( milliseconds, fmtString = nil, addDay = false )
      fmt = ""
      fmtString = "%m-%d-%Y" if fmtString.nil?
      if milliseconds
         milliseconds_s = milliseconds.to_s
         if milliseconds_s.length == 13
            t = Time.at( milliseconds_s[0,10].to_i,  milliseconds_s[10,3].to_i )
            t += (60 * 60 * 24) if addDay
            fmt = t.strftime(  fmtString )
         elsif milliseconds_s.length > 0
            t = Time.at( (milliseconds_s.to_i) / 1000 )
            t += (60 * 60 * 24) if addDay
            fmt = t.strftime(  fmtString )
         end
      end
      fmt
   end
1142915
def _x_format(self):
        """"""

        def timedelta_to_str(x):
            td = timedelta(seconds=x)
            return self.x_value_formatter(td)

        return timedelta_to_str
535885
def CopyToDateTimeString(self):
    
    if self._timestamp is None:
      return None

    number_of_days, hours, minutes, seconds = self._GetTimeValues(
        self._timestamp)

    year, month, day_of_month = self._GetDateValues(number_of_days, 1970, 1, 1)

    if self.fraction_of_second is None:
      return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}'.format(
          year, month, day_of_month, hours, minutes, seconds)

    if pytsk3.TSK_VERSION_NUM >= 0x040200ff:
      return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:09d}'.format(
          year, month, day_of_month, hours, minutes, seconds,
          self.fraction_of_second)

    return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:07d}'.format(
        year, month, day_of_month, hours, minutes, seconds,
        self.fraction_of_second)
495710
def vault_time_to_s(time_string):
    """"""
    if not time_string or len(time_string) < 2:
        raise aomi.exceptions \
                  .AomiData("Invalid timestring %s" % time_string)

    last_char = time_string[len(time_string) - 1]
    if last_char == 's':
        return int(time_string[0:len(time_string) - 1])
    elif last_char == 'm':
        cur = int(time_string[0:len(time_string) - 1])
        return cur * 60
    elif last_char == 'h':
        cur = int(time_string[0:len(time_string) - 1])
        return cur * 3600
    elif last_char == 'd':
        cur = int(time_string[0:len(time_string) - 1])
        return cur * 86400
    else:
        raise aomi.exceptions \
            .AomiData("Invalid time scale %s" % last_char)
766216
def time_str_to_minutes(time_str):
    
    time_arr = time_str.split(":")
    hours = int(time_arr[0])
    minutes = int(time_arr[1])
    return hours * 60 + minutes
68099
def format(self, record):
        """"""
        # NOTE(sdague): default the fancier formating params
        # to an empty string so we don't throw an exception if
        # they get used
        for key in ('instance', 'color'):
            if key not in record.__dict__:
                record.__dict__[key] = ''

        if record.__dict__.get('request_id', None):
            self._fmt = CONF.logging_context_format_string
        else:
            self._fmt = CONF.logging_default_format_string

        if (record.levelno == logging.DEBUG and
                CONF.logging_debug_format_suffix):
            self._fmt += " " + CONF.logging_debug_format_suffix

        # Cache this on the record, Logger will respect our formated copy
        if record.exc_info:
            record.exc_text = self.formatException(record.exc_info, record)
        return logging.Formatter.format(self, record)
961267
def formatter_fields_for_record(self, record):
        
        datetime_serialized = (
            datetime.now(timezone.utc).astimezone(self.tz).isoformat()
        )

        default_fields = (
            (LOGGED_AT_FIELDNAME, datetime_serialized),
            (LINE_NUMBER_FIELDNAME, record.lineno),
            (FUNCTION_NAME_FIELDNAME, record.funcName),
            (LOG_LEVEL_FIELDNAME, self.level_to_name_mapping[record.levelno]),
            (FILE_PATH_FIELDNAME, record.pathname),
        )

        for field, value in default_fields:
            if field in self.log_fields:
                yield field, value
1186879
def formatTime(self, record, datefmt=None):
        

        formatted = super(PalletFormatter, self).formatTime(
            record, datefmt=datefmt)
        return formatted + '.%03dZ' % record.msecs
997419
def formatTime(self, record, datefmt=None):
        """"""
        _seconds_fraction = record.created - int(record.created)
        _datetime_utc = time.mktime(time.gmtime(record.created))
        _datetime_utc += _seconds_fraction
        _created = self.converter(_datetime_utc)

        if datefmt:
            time_string = _created.strftime(datefmt)
        else:
            time_string = _created.strftime('%Y-%m-%dT%H:%M:%S.%fZ')
            time_string = "%s,%03d" % (time_string, record.msecs)
        return time_string
644350
def CopyToDateTimeString(self):
    
    if self._timestamp is None:
      return None

    number_of_days, hours, minutes, seconds = self._GetTimeValues(
        self._timestamp)

    year, month, day_of_month = self._GetDateValuesWithEpoch(
        number_of_days, self._EPOCH)

    return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}'.format(
        year, month, day_of_month, hours, minutes, seconds)
167435
def format(self, record):
        """"""
        if hasattr(record, 'data'):
            return "%s. DEBUG DATA=%s" % (
                logging.Formatter.format(self, record),
                record.__dict__['data'])
        return logging.Formatter.format(self, record)
529583
@Override
    public String format(LogRecord logRecord) {
        StringBuilder builder = new StringBuilder();
        long millis = logRecord.getMillis();
        String timestamp = DATE_FORMATTER.get().format(new Date(millis));
        String level = logRecord.getLevel().getName();
        String message = logRecord.getMessage();
        message = message.replace("\n", "\n        ");
        String organisation = "";
        String sourceClass = logRecord.getSourceClassName();
        if (regexFormat.get()) {
            Matcher matcher = ORGANISATION_RE.matcher(sourceClass);
            if (matcher.matches()) {
                organisation = matcher.group(1);
                sourceClass = matcher.group(2);
            }
        } else {
            StringTokenizer tokenizer = new StringTokenizer(sourceClass, ".");
            List<String> organisationList = new ArrayList<>();
            LinkedList<String> sourceClassList = new LinkedList<>();
            while (tokenizer.hasMoreTokens()) {
                String token = tokenizer.nextToken();
                if (organisationList.size() < 2) {
                    organisationList.add(token);
                } else {
                    sourceClassList.addFirst(token);
                }
            }
            if (!sourceClassList.isEmpty()) {
                organisation = implode(".", organisationList);
                ListIterator<String> it = sourceClassList.listIterator();
                boolean first = true;
                int length = 0;
                do {
                    String part = it.next();
                    int partLength = part.length();
                    boolean wasFirst = first;
                    if (first) {
                        first = false;
                    } else {
                        partLength++;
                    }
                    if (wasFirst || length + partLength < 40) {
                        length += partLength;
                    } else {
                        it.previous();
                        break;
                    }
                } while (it.hasNext());
                List<String> partList = new ArrayList<>();
                while (it.hasPrevious()) {
                    String part = it.previous();
                    partList.add(part);
                }
                sourceClass = implode(".", partList);
            }
        }
        String sourceMethod = logRecord.getSourceMethodName();
        boolean first = true;
        for (String part : new String[] { timestamp, fix(level, 8), organisation, sourceClass, sourceMethod, message }) {
            if (first) {
                first = false;
            } else {
                builder.append("|");
            }
            builder.append(part);
        }
        builder.append('\n');

        //noinspection ThrowableResultOfMethodCallIgnored
        Throwable thrown = logRecord.getThrown();
        if (thrown != null && logger.isDebugEnabled()) {
            StringWriter stringWriter = new StringWriter();
            PrintWriter printWriter = new PrintWriter(stringWriter);
            thrown.printStackTrace(printWriter);
            printWriter.close();
            String stackTrace = stringWriter.toString();
            stackTrace = DISMISS_RE.matcher(stackTrace).replaceAll("$1  $2$3");
            if (!logger.isTraceEnabled()) {
                try {
                    StringBuilder stackBuilder = new StringBuilder();
                    Matcher causedBy = CAUSED_BY_RE.matcher(stackTrace);
                    int pos = 0;
                    String block;
                    while (causedBy.find()) {
                        int nextPos = causedBy.start();
                        block = stackTrace.substring(pos, nextPos);
                        pos = nextPos;
                        stackBuilder.append(reduceStackBlock(block));
                    }
                    block = stackTrace.substring(pos);
                    stackBuilder.append(reduceStackBlock(block));
                    stackTrace = stackBuilder.toString();
                } catch (Throwable throwable) {
                    stackTrace = ">>> REDUCE FAILED: " + throwable + "\n" + stackTrace;
                }
            }
            builder.append(stackTrace);
        }
        return builder.toString();
    }
518054
public String format(LogRecord record) {
		String s = record.getLevel() + "  :  "
	            + format.format(new Date( record.getMillis() )) + " -:- "
	            + record.getMessage() + lineSep;

		return s;		
	}
975449
public static String formatDuration(long durationMs){
        Period period = Period.seconds((int)(durationMs/1000L));
        Period p2 = period.normalizedStandard(PeriodType.yearMonthDayTime());

        PeriodFormatter formatter = new PeriodFormatterBuilder()
                .appendYears()
                .appendSuffix(" yr ")
                .appendMonths()
                .appendSuffix(" months ")
                .appendDays()
                .appendSuffix(" days ")
                .appendHours()
                .appendSuffix(" hr ")
                .appendMinutes()
                .appendSuffix(" min ")
                .appendSeconds()
                .appendSuffix(" sec")
                .toFormatter();

        return formatter.print(p2);
    }
241789
def format(
            self,
            record,
            datefmt='%Y:%m:%d %H:%M:%S.%f'):
        

        now = datetime.datetime.now()
        utc_now = datetime.datetime.utcnow()
        asctime = None
        if self.datefmt:
            asctime = now.strftime(
                self.datefmt)
        else:
            asctime = now.strftime(
                datefmt)

        message = {
            'time': record.created,
            'timestamp': utc_now.strftime(
                '%Y-%m-%dT%H:%M:%S.%fZ'),
            'asctime': asctime,
            'path': record.pathname,
            'message': record.getMessage(),
            'exc': None,
            'logger_name': record.name
        }

        if record.exc_info and not message.get('exc'):
            message['exc'] = self.formatException(
                record.exc_info)
        if not message.get(
                'exc') and record.exc_text:
            message['exc'] = record.exc_text

        log_record = {}
        try:
            log_record = OrderedDict()
        except NameError:
            log_record = {}
        # end of try/ex

        message.update(
            self.fields_to_add)
        self.add_fields(
            log_record,
            record,
            message)
        use_log_record = self.process_log_record(
            log_record)
        return '{}{}'.format(
            self.prefix,
            self.jsonify_log_record(
                use_log_record))
918314
def _CopyToDateTimeString(self):
    
    if self._timestamp is None:
      return None

    timestamp, nanoseconds = divmod(
        self._timestamp, definitions.NANOSECONDS_PER_SECOND)
    number_of_days, hours, minutes, seconds = self._GetTimeValues(timestamp)

    year, month, day_of_month = self._GetDateValuesWithEpoch(
        number_of_days, self._EPOCH)

    return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:09d}'.format(
        year, month, day_of_month, hours, minutes, seconds, nanoseconds)