Will convert a time string, as recognized by other Vault
    tooling, into an integer representation of seconds
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)
158622
def str2unixtime(ts, fmt='%Y-%m-%d %H:%M:%S'):
    
    t = time.strptime(ts, fmt)
    return int(time.mktime(t))
1205018
def pprint(self, seconds):
        
        return ("%d:%02d:%02d.%03d", reduce(lambda ll, b: divmod(ll[0], b) + ll[1:], [(seconds * 1000,), 1000, 60, 60]))
418974
def to_python(self, value):
        ''''''
        if isinstance(value, Seconds):
            return value
        if value in self.empty_values:
            return None
        return self.parse_seconds(value)
723188
function(timestamp) {
        if (!timestamp) {
            return;
        }
        //TODO check this
        //var secondsPerStamp = 1.001,
        var timesplit = timestamp.replace(',', ':').split(':');
        return (parseInt(timesplit[0], 10) * 3600 +
            parseInt(timesplit[1], 10) * 60 +
            parseInt(timesplit[2], 10) +
            parseInt(timesplit[3], 10) / 1000) * 1000 * 1000;

    }
512170
def decTimeToDeg(sign_sym, deg, min, sec):
    """"""
    if sign_sym == -1 or sign_sym == '-':
        sign = -1
    else:
        sign = 1
    return dmsToDeg(sign, deg, min, sec)
97944
function stringToMs(str){
   let summ = 0, time, type, value;
   let time_list = ('' + str).split(' ').filter(v => v != '' && /^(\d{1,}\.)?\d{1,}([wdhms])?$/i.test(v));

   for(let i = 0, len = time_list.length; i < len; i++){
      time = time_list[i];
      type = time.match(/[wdhms]$/i);

      if(type){
         value = Number(time.replace(type[0], ''));

         switch(type[0].toLowerCase()){
            case 'w':
               summ += value * 604800000;
            break;
            case 'd':
               summ += value * 86400000;
            break;
            case 'h':
               summ += value * 3600000;
            break;
            case 'm':
               summ += value * 60000;
            break;
            case 's':
               summ += value * 1000;
            break;
         }
      }else if(!isNaN(parseFloat(time)) && isFinite(time)){
         summ += parseFloat(time);
      }
   }
   return summ;
}
377001
def get_formatted_time(seconds: float) -> str:
    
    seconds = round(seconds)
    m, s = divmod(seconds, 60)
    h, m = divmod(m, 60)
    return '{:d}:{:02d}:{:02d}'.format(h, m, s)
1228272
def _encode_timestamp(name, value, dummy0, dummy1):
    """"""
    return b"\x11" + name + _PACK_TIMESTAMP(value.inc, value.time)
582818
function( time ) {
		var h, m, s;

		if ( time > TIME_MINUTE ) {
			m = parseInt( time / TIME_MINUTE, 10 );
			s = ( time % TIME_MINUTE ) / TIME_SECOND;
			return m + 'mins, ' + s + 's';
		}
		else if ( time > TIME_SECOND ) {
			return ( time / TIME_SECOND ) + 's';
		}
		else {
			return time + 'ms';
		}
	}
862547
private static String time2Str(long elapsedTime) {
    String unit;
    double time = elapsedTime;
    if (elapsedTime < 1000) {
      unit = "milliseconds";
    } else if (elapsedTime < 60*1000) {
      unit = "seconds";
      time = time/1000;
    } else if (elapsedTime < 3600*1000) {
      unit = "minutes";
      time = time/(60*1000);
    } else {
      unit = "hours";
      time = time/(3600*1000);
    }

    return time+" "+unit;
  }
621163
def SecondsToZuluTS(secs=None):
	

	if not secs:  secs = int(time.time())

	return(datetime.utcfromtimestamp(secs).strftime("%Y-%m-%dT%H:%M:%SZ"))
801444
def format_time_small(seconds):
    

    if not isinstance(seconds, (int, float)):
        return str(seconds)

    if math.isnan(seconds):
        return "-"

    if abs(seconds)<1:
        milliseconds = 1000*seconds
        if abs(milliseconds)<1:
            microseconds = 1000*milliseconds
            if abs(microseconds)<1:
                nanoseconds = 1000*microseconds
                if abs(nanoseconds)<0.5:
                    return "0"
                else:
                    return "{:.0f}ns".format(nanoseconds)
            elif abs(microseconds)<10:
                return "{:.2f}us".format(microseconds)
            elif abs(microseconds)<100:
                return "{:.1f}us".format(microseconds)
            else:
                return "{:.0f}us".format(microseconds)
        elif abs(milliseconds)<10:
            return "{:.2f}ms".format(milliseconds)
        elif abs(milliseconds)<100:
            return "{:.1f}ms".format(milliseconds)
        else:
            return "{:.0f}ms".format(milliseconds)
    elif abs(seconds)<10:
            return "{:.2f}s".format(seconds)
    elif abs(seconds)<100:
        return "{:.1f}s".format(seconds)
    else:
        return "{:.0f}s".format(seconds)
1348198
def show_time_as_short_string(self, seconds):
        
        if seconds < 60:
            return str(seconds) + ' seconds'
        elif seconds < 3600:
            return str(round(seconds/60, 1)) + ' minutes'
        elif seconds < 3600*24:
            return str(round(seconds/(60*24), 1)) + ' hours'
        elif seconds < 3600*24*365:
            return str(round(seconds/(3600*24), 1)) + ' days'
        else:
            print('WARNING - this will take ' + str(seconds/(60*24*365)) + ' YEARS to run' )
            return str(round(seconds/(60*24*365), 1)) + ' years'
787545
def time_from_number(self, value):
        
        if not isinstance(value, numbers.Real):
            return None
        delta = datetime.timedelta(days=value)
        minutes, second = divmod(delta.seconds, 60)
        hour, minute = divmod(minutes, 60)
        return datetime.time(hour, minute, second)
494742
function humanizeMilliseconds(value) {
        if (!angular.isNumber(value)) {
            return "XXX";
        }
        var seconds = value / 1000;
        var years = Math.floor(seconds / 31536000);
        if (years) {
            return maybePlural(years, "year");
        }
        var days = Math.floor((seconds %= 31536000) / 86400);
        if (days) {
            return maybePlural(days, "day");
        }
        var hours = Math.floor((seconds %= 86400) / 3600);
        if (hours) {
            return maybePlural(hours, 'hour');
        }
        var minutes = Math.floor((seconds %= 3600) / 60);
        if (minutes) {
            return maybePlural(minutes, 'minute');
        }
        seconds = Math.floor(seconds % 60);
        if (seconds) {
            return maybePlural(seconds, 'second');
        }
        return value + " ms";
    }
1340457
def micros_to_timestamp(micros, timestamp):
  
  seconds = long(micros / _MICROS_PER_SECOND)
  micro_remainder = micros % _MICROS_PER_SECOND
  timestamp.seconds = seconds
  timestamp.nanos = micro_remainder * _NANOS_PER_MICRO