Extract the uptime string from the given Cisco IOS Device.
        Return the uptime in seconds as an integer
338783
def parse_uptime(uptime_str):
        
        # Initialize to zero
        (years, weeks, days, hours, minutes) = (0, 0, 0, 0, 0)

        uptime_str = uptime_str.strip()
        time_list = uptime_str.split(",")
        for element in time_list:
            if re.search("year", element):
                years = int(element.split()[0])
            elif re.search("week", element):
                weeks = int(element.split()[0])
            elif re.search("day", element):
                days = int(element.split()[0])
            elif re.search("hour", element):
                hours = int(element.split()[0])
            elif re.search("minute", element):
                minutes = int(element.split()[0])
            elif re.search("second", element):
                seconds = int(element.split()[0])

        uptime_sec = (
            (years * YEAR_SECONDS)
            + (weeks * WEEK_SECONDS)
            + (days * DAY_SECONDS)
            + (hours * 3600)
            + (minutes * 60)
            + seconds
        )
        return uptime_sec
34122
def get_snmp_value(sess, helper, oid):
        
        snmp_result = sess.get_oids(oid)[0]
        if snmp_result is None:
            helper.exit(summary="No response from device for oid " + oid, exit_code=unknown, perfdata='')

        else:
            return snmp_result
1095342
def getNextTimeout(self):
        
        timeval = libusb1.timeval()
        result = libusb1.libusb_get_next_timeout(
            self.__context_p, byref(timeval))
        if result == 0:
            return None
        elif result == 1:
            return timeval.tv_sec + (timeval.tv_usec * 0.000001)
        raiseUSBError(result)
304293
def is_up(self):
        '''  '''

        # Get existing device flags
        ifreq = struct.pack('16sh', self.name, 0)
        flags = struct.unpack('16sh', fcntl.ioctl(sockfd, SIOCGIFFLAGS, ifreq))[1]

        # Set new flags
        if flags & IFF_UP:
            return True
        else:
            return False
1123883
def get_serial_number_string(self):
        
        self._check_device_status()
        str_p = ffi.new("wchar_t[]", 255)
        rv = hidapi.hid_get_serial_number_string(self._device, str_p, 255)
        if rv == -1:
            raise IOError("Failed to read serial number string from HID "
                          "device: {0}".format(self._get_last_error_string()))
        return ffi.string(str_p)
311913
def commission
      response = nil
      begin
        unlock_network
        Timeout.timeout(30) do
          @logger.info("Listening for devices ...")
          loop do
            buffer = @serial.receive(4)
            buffer += @serial.receive(buffer.bytes.to_a[3]+1)
            if buffer.bytes.to_a[1] == 0xa0
              response = BroadcastResponse.read(buffer)
              @logger.info("Found device 0x%x on network 0x%x" % [response.device_id, response.network_id])
              break
            end
          end
        end
      rescue Timeout::Error
      ensure
        lock_network
      end

      update_time(response.network_id) if response
    end
550865
function getServer() {
  var o = {}
    , uptime = process.uptime()
  o.version = this.version;
  o.os = process.platform;
  o.arch = process.arch;
  o.process_id = process.pid;

  o.tcp_port = this.state.addr && this.state.addr.port
    ? this.state.addr.port : NA;

  o.uptime_in_seconds = uptime;
  o.uptime_in_days = Math.floor(uptime / DAY_SECS);
  o.hz = this.conf.get(ConfigKey.HZ);
  o.config_file = this.conf.isDefault() ? '' : this.conf.getFile();
  return o;
}
904197
def getSystemInfo(self, timeout=1):
        
        namespace = System.getServiceType("getSystemInfo")
        uri = self.getControlURL(namespace)

        results = self.execute(uri, namespace, "GetInfo", timeout=timeout)

        return SystemInfo(results)
439003
def wait_for_up(self, timeout=40):
        

        self.wait_for_states(timeout, 'up')
        connectionStatus = self.get_attribute('connectionStatus').strip()
        if connectionStatus.split(':')[0] != self.get_attribute('assignedTo').split(':')[0]:
            raise TgnError('Failed to reach up state, port connection status is {} after {} seconds'.
                           format(connectionStatus, timeout))
1234605
def get_device_address(device):
    
    if device is None:
        return None
    command = ['ip', 'route', 'list', 'dev', device]
    ip_routes = subprocess.check_output(command).strip()
    for line in ip_routes.split('\n'):
        seen = ''
        for a in line.split():
            if seen == 'src':
                return a
            seen = a
    return None
660669
def get_devicelist(home_hub_ip='192.168.1.254'):
    

    url = 'http://{}/'.format(home_hub_ip)

    try:
        response = requests.get(url, timeout=5)
    except requests.exceptions.Timeout:
        _LOGGER.exception("Connection to the router timed out")
        return
    if response.status_code == 200:
        return parse_devicelist(response.text)
    else:
        _LOGGER.error("Invalid response from Home Hub: %s", response)
345544
def _get_uptime(self, app_stats):
        
        if "program_start" not in app_stats.keys():
            return 0

        if not app_stats["program_start"].isdigit():
            return 0

        uptime = int(time.time()) - int(app_stats["program_start"])
        if uptime < 0:
            return 0

        return uptime
753653
def get_time(self):
        ''''''
        systime = time.time() - self.mpstate.start_time_s
        if not self.mpstate.is_sitl:
            return systime
        try:
            speedup = int(self.get_mav_param('SIM_SPEEDUP',1))
        except Exception:
            return systime
        if speedup != 1:
            return self.mpstate.attitude_time_s
        return systime
864421
def simxGetPingTime(clientID):
    '''
    
    '''
    pingTime = ct.c_int()
    return c_GetPingTime(clientID, ct.byref(pingTime)), pingTime.value
1261057
public function toUptimeString($uptime)
    {
        return (string) CarbonInterval::days(
            isset($uptime['up_days']) ? $uptime['up_days'] : 0
        )
            ->hours(isset($uptime['up_hours']) ? $uptime['up_hours'] : 0)
            ->minutes(isset($uptime['up_minutes']) ? $uptime['up_minutes'] : 0);
    }
356377
def obtain_hosting_device_credentials_from_config():
    
    cred_dict = get_specific_config('cisco_hosting_device_credential')
    attr_info = {
        'name': {'allow_post': True, 'allow_put': True,
                 'validate': {'type:string': None}, 'is_visible': True,
                 'default': ''},
        'description': {'allow_post': True, 'allow_put': True,
                        'validate': {'type:string': None},
                        'is_visible': True, 'default': ''},
        'user_name': {'allow_post': True, 'allow_put': True,
                      'validate': {'type:string': None},
                      'is_visible': True, 'default': ''},
        'password': {'allow_post': True, 'allow_put': True,
                     'validate': {'type:string': None},
                     'is_visible': True, 'default': ''},
        'type': {'allow_post': True, 'allow_put': True,
                 'validate': {'type:string': None}, 'is_visible': True,
                 'default': ''}}
    credentials = {}
    for cred_uuid, kv_dict in cred_dict.items():
        # ensure cred_uuid is properly formatted
        cred_uuid = uuidify(cred_uuid)
        verify_resource_dict(kv_dict, True, attr_info)
        credentials[cred_uuid] = kv_dict
    return credentials
869539
def getIPString():
        
        if not(NetInfo.systemip):
            NetInfo.systemip = ",".join(NetInfo.getSystemIps())
        return NetInfo.systemip