Private: Updates the time of a device.

 This must be executed within an open session. I'm guessing it selects the
 network.

 network_id - 2 byte identified for the network.

 Returns nothing.
324264
def update_time(network_id)
      @serial.transmit(UpdateTimeRequest.new(:network_id => network_id))
      UpdateTimeAckResponse.read(@serial.receive(6))
      UpdateTimeResponse.read(@serial.receive(8))
    end
976982
def get_using_network_time():
    '''
    
    '''
    ret = salt.utils.mac_utils.execute_return_result(
        'systemsetup -getusingnetworktime')

    return salt.utils.mac_utils.validate_enabled(
        salt.utils.mac_utils.parse_return(ret)) == 'on'
472395
def update(self):
        """"""
        node = self._fritz.get_device_element(self.ain)
        self._update_from_node(node)
1089918
def update(self, timedelta, *args, **kwargs):
        

        # TODO move time management somewhere else...
        self.last_update += timedelta
        # if shutdown we want to bypass the update_interval check
        # if shutting_down:
        #     self.interface.update(shutting_down=shutting_down)
        #     return 0  # return 0 as success since we arrived here without exception
        # else
        if self.last_update > self.update_interval:
            self.last_update = 0
            self.interface.update()
1297916
def _set_time(self, m):
        ''''''
        # really just left here for profiling
        m._timestamp = self.timestamp
        if len(m._fieldnames) > 0 and self.clock is not None:
            self.clock.set_message_timestamp(m)
24772
def update(self, *args):
        

        gmtexpires = None
        (name, ip, expires) = args[:3]

        for arg in args:
            if arg.lower().startswith('expires='):
                gmtexpires = arg[8:]

        if gmtexpires is None:
            if len(args) == 3:
                gmtexpires = expires
            else:
                if args[2] == 'NEVER':
                    gmtexpires = args[2]
                else:
                    gmtexpires = args[3]

        self.name = name                # "www.example.com"
        self.ip = maybe_ip_addr(ip)     # IPV4Address instance, or string

        if self.ip == '<error>':
            self._expire()
            return

        fmt = "%Y-%m-%d %H:%M:%S"

        # if we already have expiry times, etc then we want to
        # properly delay our timeout

        oldexpires = self.expires

        if gmtexpires.upper() == 'NEVER':
            # FIXME can I just select a date 100 years in the future instead?
            self.expires = None
        else:
            self.expires = datetime.datetime.strptime(gmtexpires, fmt)
        self.created = datetime.datetime.utcnow()

        if self.expires is not None:
            if oldexpires is None:
                if self.expires <= self.created:
                    diff = datetime.timedelta(seconds=0)
                else:
                    diff = self.expires - self.created
                self.expiry = self.map.scheduler.callLater(diff.seconds,
                                                           self._expire)

            else:
                diff = self.expires - oldexpires
                self.expiry.delay(diff.seconds)
236902
def update_subnet(self, subnet, name=None):
        '''
        
        '''
        subnet_id = self._find_subnet_id(subnet)
        return self.network_conn.update_subnet(
            subnet=subnet_id, body={'subnet': {'name': name}})
325756
def updateDeviceState(self, device):
        
        # this is only threadsafe because the targetstate is effectively immutable, if it becomes mutable in future then
        # funkiness may result
        self._reactor.offer(REACH_TARGET_STATE, [self._targetStateProvider.state, device, self._httpclient])
261173
def updateNetwork(self, data, id, headers=None, query_params=None, content_type="application/json"):
        
        uri = self.client.base_url + "/network/"+id
        return self.client.post(uri, data, headers, query_params, content_type)
761574
def update(self, data):
        """"""
        if data is None:
            for device in self.devices:
                device.clear_info()
        else:
            for device, device_info in zip(self.devices, data):
                device.device_info = device_info
                self.connection.log("Device information updated -> [{}]".format(device))
665996
def run(self, resources):
        
        hwman = resources['connection']
        con = hwman.hwman.controller()
        test_interface = con.test_interface()
        try:
            test_interface.synchronize_clock()
            print('Time currently set at %s' % test_interface.current_time_str())
        except:
            raise ArgumentError('Error setting RTC time, check if controller actually has RTC or if iotile-support-lib-controller-3 is updated')
427027
def _new_device_id(self, key):
        
        device_id = Id.SERVER + 1
        if key in self._key2deviceId:
            return self._key2deviceId[key]
        while device_id in self._clients:
            device_id += 1
        return device_id
563480
def latency
      start = Time.now.to_f
      send_message!(Protocol::Device::GetTime.new, wait_for: Protocol::Device::StateTime)
      Time.now.to_f - start
    end
1213956
def updateDeviceStatus(self, deviceName, state, reason=None):
        
        logger.info('Updating recording device state for ' + deviceName + ' to ' + state.name +
                    ('' if reason is None else '[reason: ' + reason + ']'))
        currentState = self.recordingDevices.get(deviceName)
        count = 0
        if currentState is not None:
            if currentState['state'] == MeasurementStatus.RECORDING.name:
                count = currentState['count']
        self.recordingDevices[deviceName] = {
            'state': state.name,
            'reason': reason,
            'time': datetime.datetime.utcnow().strftime(DATETIME_FORMAT),
            'count': count
        }
802602
function() {
                /**
                 * Initialize Cache Databases
                 */
                startCacheDatabases();

                if (grantDeviceIdFromSSO) {
                    var getDeviceIdWithTokenTime = new Date().getTime();
                    getDeviceIdWithToken(function(retrievedDeviceId) {

                        if (actualTimingLog) {
                            Utility.chatStepLogger('Get Device ID ', new Date().getTime() - getDeviceIdWithTokenTime);
                        }

                        deviceId = retrievedDeviceId;

                        initAsync();
                    });
                }
                else {
                    initAsync();
                }
            }
1096503
def update_floatingip(self, floatingip_id, port=None):
        '''
        
        '''
        if port is None:
            body = {'floatingip': {}}
        else:
            port_id = self._find_port_id(port)
            body = {'floatingip': {'port_id': port_id}}
        return self.network_conn.update_floatingip(
            floatingip=floatingip_id, body=body)
1207534
def set_time(self, time):
        '''
        
        '''
        times = num2date(time[:].squeeze(), time.units)
        self.time = pd.DatetimeIndex(pd.Series(times), tz=self.location.tz)