Takes a MAC address in various formats:

- 00:00:00:00:00:00,
- 00-00-00-00-00-00,
- 0000.0000.0000

... and returns it in the format 00:00:00:00:00:00.

@param  {string} mac
@return {string}
966381
function normalize (mac) {
  let m = CISCO_MAC_ADDRESS_RE.exec(mac)
  if (m) {
    const halfwords = m.slice(1)
    mac = halfwords.map((halfword) => {
      return zeroFill(4, halfword)
    }).join('')
    return chunk(mac, 2).join(':').toUpperCase()
  }

  m = MAC_ADDRESS_RE.exec(mac)
  if (m) {
    const bytes = m.slice(1)
    return bytes
      .map(byte => zeroFill(2, byte))
      .join(':')
      .toUpperCase()
  }
}
521556
function (timeFormat) {
				var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),
					orders = {
						h: -1,
						m: -1,
						s: -1,
						l: -1,
						c: -1,
						t: -1,
						z: -1
					};

				if (finds) {
					for (var i = 0; i < finds.length; i++) {
						if (orders[finds[i].toString().charAt(0)] === -1) {
							orders[finds[i].toString().charAt(0)] = i + 1;
						}
					}
				}
				return orders;
			}
647919
function format(ms) {
  if (ms == d) return Math.round(ms / d) + ' day';
  if (ms > d) return Math.round(ms / d) + ' days';
  if (ms == h) return Math.round(ms / h) + ' hour';
  if (ms > h) return Math.round(ms / h) + ' hours';
  if (ms == m) return Math.round(ms / m) + ' minute';
  if (ms > m) return Math.round(ms / m) + ' minutes';
  if (ms == s) return Math.round(ms / s) + ' second';
  if (ms > s) return Math.round(ms / s) + ' seconds';
  return ms + ' ms';
}
1139588
def get_mac(self):
        
        command = const.CMD_OPTIONS_RRQ
        command_string = b'MAC\x00'
        response_size = 1024

        cmd_response = self.__send_command(command, command_string, response_size)
        if cmd_response.get('status'):
            mac = self.__data.split(b'=', 1)[-1].split(b'\x00')[0]
            return mac.decode()
        else:
            raise ZKErrorResponse("can't read mac address")
89648
public static String formatAddress(int address) {
		int b1 = (address >>> 24) & 0xff;
		int b2 = (address >>> 16) & 0xff;
		int b3 = (address >>>  8) & 0xff;
		int b4 =  address         & 0xff;

		return "" + b1 + '.' + b2 + '.' + b3 + '.' + b4;
	}
544851
function formatTime(time) {
  let date = new Date(time);

  return (date.getFullYear() + '-' +
    zeroPad(date.getMonth() + 1) + '-' +
    zeroPad(date.getDate()) + ' ' +
    zeroPad(date.getHours()) + ':' +
    zeroPad(date.getMinutes()) + ':' +
    zeroPad(date.getSeconds()));

  function zeroPad(num) {
    return ('0' + num).slice(-2)
  }
}
301044
def calculate_mac(mac_type, resource, content_hash):
    """"""
    normalized = normalize_string(mac_type, resource, content_hash)
    log.debug(u'normalized resource for mac calc: {norm}'
              .format(norm=normalized))
    digestmod = getattr(hashlib, resource.credentials['algorithm'])

    # Make sure we are about to hash binary strings.

    if not isinstance(normalized, six.binary_type):
        normalized = normalized.encode('utf8')
    key = resource.credentials['key']
    if not isinstance(key, six.binary_type):
        key = key.encode('ascii')

    result = hmac.new(key, normalized, digestmod)
    return b64encode(result.digest())
1172166
function getTime(ts) {
		function pad2(n) {
			return n < 10 ? '0' + n : n;
		}

		function pad3(n) {
			return n < 10 ? '00' + n : (n < 100 ? '0' + n : n);
		}

		return pad2(ts.getHours()) + ':' +
			pad2(ts.getMinutes()) + ':' +
			pad2(ts.getSeconds()) + '.' +
			pad3(ts.getMilliseconds());
	}
301888
function timeCode(seconds, delim = ':') {
    // const h = Math.floor(seconds / 3600);
    // const m = Math.floor((seconds % 3600) / 60);
    const m = Math.floor(seconds / 60);
    const s = Math.floor((seconds % 3600) % 60);
    // const hr = (h < 10 ? '0' + h + delim : h + delim);
    const mn = (m < 10 ? '0' + m : m) + delim;
    const sc = (s < 10 ? '0' + s : s);
    // return hr + mn + sc;
    return mn + sc;
}
57570
function Time(timeString) {
    babelHelpers.classCallCheck(this, Time);

    // Return if timeString not a string
    if (timeString && 'string' != typeof timeString) return timeString;

    this._date = DEFAULT_DATE;
    this._locale = null;
    this._offset = 0;
    this._offsetString = DEFAULT_OFFSET;
    this.isValid = false;
    this.timeString = DEFAULT_DATE;

    // Local "now"
    if (timeString == null) timeString = clientNow();
    // Prevent regex denial of service
    if (timeString.length > 30) return;

    var match = timeString.match(RE_PARSE);

    if (!match) return;

    // We check for match[i] == null because of a bug in Samsung Internet browser causing the RegEx matching to fail after many iterations
    // Link to GitHub issue: https://github.com/SamsungInternet/support/issues/82
    var year = parseInt(match[1], 10);
    var month = match[2] == null ? 1 : parseInt(match[2], 10);
    var day = match[3] == null ? 1 : parseInt(match[3], 10);
    var hour = match[4] == null ? 0 : parseInt(match[4], 10);
    var minute = match[5] == null ? 0 : parseInt(match[5], 10);
    var second = match[6] == null ? 0 : parseInt(match[6], 10);
    var millisecond = match[7] == null ? 0 : parseInt(match[7], 10);
    var offset = match[8] == null ? '' : match[8];

    // Handle TZ offset
    if (offset && offset != DEFAULT_OFFSET) {
      var dir = match[9] == '+' ? 1 : -1;

      this._offset = dir * (+match[10] * 60 + +match[11]);
      this._offsetString = offset;
    }

    // Create UTC date based on local time so we can always use UTC methods
    this._date = new Date(Date.UTC(year, month - 1, day, hour, minute, second, millisecond));
    this.isValid = isValid(this._date);
    this.timeString = this.toString();
  }
1298628
def mac_address(ip):
    """"""
    mac = ''
    for line in os.popen('/sbin/ifconfig'):
        s = line.split()
        if len(s) > 3:
            if s[3] == 'HWaddr':
                mac = s[4]
            elif s[2] == ip:
                break
    return {'MAC': mac}
357885
private function _compareMac($a, $b) {
        $result = "\x00";

        for ($i = 0; $i < $this->_macByteCount; $i++) {
            $result |= substr($a, $i, 1) ^ substr($b, $i, 1);
        }
        
        /* \x00 if equal, nonzero otherwise */
        return ($result === "\x00");
    }
705508
def check_mac(original_mac):
    '''
    
    '''
    mac = (original_mac.upper()).strip()
    parts = mac.split(':')
    if len(parts) == 6:
        # let's think that it is a : separated mac
        for p in parts:
            if len(p) != 2:
                return None
        mac = ''.join(parts)
    elif len(parts) > 1:
        return None
    for c in mac:
        if c not in '0123456789ABCDEF':
            return None
    return mac
389600
function timestamp () {
  const date = new Date()

  return [
    zeropad(date.getHours()),
    zeropad(date.getMinutes()),
    zeropad(date.getSeconds())
  ].join(':')
}
975107
function (digest) {
        var initialized = false;
        var key, ipad, opad;
        var init = function () {
            var i, kbuf;
            if (initialized) {
                return;
            }
            if (key === undefined) {
                throw "MAC key is not defined";
            }
            if (key.byteLength > 64) { /* B = 64 */
                kbuf = new Uint8Array(digest.digest(key));
            } else {
                kbuf = new Uint8Array(key);
            }
            ipad = new Uint8Array(new ArrayBuffer(64));
            for (i = 0; i < kbuf.length; i++) {
                ipad[i] = 0x36 ^ kbuf[i];
            }
            for (i = kbuf.length; i < 64; i++) {
                ipad[i] = 0x36;
            }
            opad = new Uint8Array(new ArrayBuffer(64));
            for (i = 0; i < kbuf.length; i++) {
                opad[i] = 0x5c ^ kbuf[i];
            }
            for (i = kbuf.length; i < 64; i++) {
                opad[i] = 0x5c;
            }
            initialized = true;
            digest.update(ipad.buffer);
        };

        var resetMac = function () {
            initialized = false;
            key = undefined;
            ipad = undefined;
            opad = undefined;
            digest.reset();
        };

        var finalizeMac = function () {
            var result = digest.finalize();
            digest.reset();
            digest.update(opad.buffer);
            digest.update(result);
            result = digest.finalize();
            resetMac();
            return result;
        };

        var setKeyMac = function (k) {
            key = k;
        };

        return {
            setKey: function (key) {
                setKeyMac(convertToUint8Array(key));
                init();
            },

            update: function (input) {
                digest.update(input);
            },

            finalize: function () {
                return finalizeMac();
            },

            mac: function (input) {
                this.update(input);
                return this.finalize();
            },

            reset: function () {
                resetMac();
            },

            hmacLength: function () {
                return digest.digestLength();
            }
        };
    }
323876
function (value) {
        /// <summary>Formats a DateTime or DateTimeOffset value a string.</summary>
        /// <param name="value" type="Date" mayBeNull="false">Value to format.</param>
        /// <returns type="String">Formatted text.</returns>
        /// <remarks>If the value is already as string it's returned as-is.</remarks>

        if (typeof value === "string") {
            return value;
        }

        var hasOffset = isDateTimeOffset(value);
        var offset = getCanonicalTimezone(value.__offset);
        if (hasOffset && offset !== "Z") {
            // We're about to change the value, so make a copy.
            value = new Date(value.valueOf());

            var timezone = parseTimezone(offset);
            var hours = value.getUTCHours() + (timezone.d * timezone.h);
            var minutes = value.getMinutes() + (timezone.d * timezone.m);

            value.setUTCHours(hours, minutes);
        } else if (!hasOffset) {
            // Don't suffix a 'Z' for Edm.DateTime values.
            offset = "";
        }

        var year = value.getUTCFullYear();
        var month = value.getUTCMonth() + 1;
        var sign = "";
        if (year <= 0) {
            year = -(year - 1);
            sign = "-";
        }

        var ms = formatMilliseconds(value.getUTCMilliseconds(), value.__ns);

        return sign +
            formatNumberWidth(year, 4) + "-" +
            formatNumberWidth(month, 2) + "-" +
            formatNumberWidth(value.getUTCDate(), 2) + "T" +
            formatNumberWidth(value.getUTCHours(), 2) + ":" +
            formatNumberWidth(value.getUTCMinutes(), 2) + ":" +
            formatNumberWidth(value.getUTCSeconds(), 2) +
            ms + offset;
    }
1012468
function timeToTimecode(time) {
	return `${`0${Math.floor(time / 60)}`.slice(-2)}:${`0${Math.floor(time % 60)}`.slice(-2)}`;
}