Get server time.
        Optional arguments:
        * target=None - Target server.
167020
def time(self, target=None):
        
        with self.lock:
            if target:
                self.send('TIME %s' % target)
            else:
                self.send('TIME')
            time = ''
            msg = self._recv(rm_colon=True, expected_replies=('391',))
            if msg[0] == '391':
                time = msg[2].split(':', 1)[1]
            return time
1117510
def _get_cached_time(self):
        
        if not self._cached_time:
            self._cached_time = self._meta.datetime.utcnow()

        return self._cached_time
150221
def ping(self, timestamp=None):
        
        cmd = 'ping'
        if timestamp: cmd += ' %s' % timestamp
        return tuple(map(float, self.fetch(cmd)[1].split()[1:]))
1043712
def ping(self):
        
        start = time.time()
        self._conn.ping()
        return (time.time() - start)
998429
def get_times(self):
        
        send_time = ctypes.c_int32()
        recv_time = ctypes.c_int32()
        result = self.library.Par_GetTimes(self.pointer, ctypes.byref(send_time),
                                   ctypes.byref(recv_time))
        check_error(result, "partner")
        return send_time, recv_time
294951
def _servicegroup_get_server(sg_name, s_name, s_port=None, **connection_args):
    '''
    
    '''
    ret = None
    servers = _servicegroup_get_servers(sg_name, **connection_args)
    if servers is None:
        return None
    for server in servers:
        if server.get_servername() == s_name:
            if s_port is not None and s_port != server.get_port():
                ret = None
            ret = server
    return ret
439216
def get_current_time(self):
        
        current_time = c_double()
        self.library.get_current_time.argtypes = [POINTER(c_double)]
        self.library.get_current_time.restype = None
        self.library.get_current_time(byref(current_time))
        return current_time.value
1342680
def utime(self, tarinfo, targetpath):
        
        if not hasattr(os, 'utime'):
            return
        try:
            os.utime(targetpath, (tarinfo.mtime, tarinfo.mtime))
        except EnvironmentError as e:
            raise ExtractError("could not change modification time")
321361
def get_target(cls, scheme, path, fragment, username,
                   password, hostname, port, query, **kwargs):
        
        raise NotImplementedError("get_target must be overridden")
818497
def get_offset(target):
    
    from pytz import timezone
    import pytz
    from datetime import datetime

    utc = pytz.utc

    today = datetime.now()
    tz_target = timezone(tf.certain_timezone_at(lat=target['lat'], lng=target['lng']))
    # ATTENTION: tz_target could be None! handle error case
    today_target = tz_target.localize(today)
    today_utc = utc.localize(today)
    return (today_utc - today_target).total_seconds() / 60
37961
def get_time(self, idx=0):
        
        timestr = SingleTifPhasics._get_meta_data(path=self.path,
                                                  section="acquisition info",
                                                  name="date & heure")
        if timestr is not None:
            timestr = timestr.split(".")
            # '2016-04-29_17h31m35s.00827'
            structtime = time.strptime(timestr[0],
                                       "%Y-%m-%d_%Hh%Mm%Ss")
            fracsec = float(timestr[1]) * 1e-5
            # use calendar, because we need UTC
            thetime = calendar.timegm(structtime) + fracsec
        else:
            thetime = np.nan
        return thetime
441165
def receive_packet(self, time=0):
        
        if time == 0:
            try:
                return self.in_queue.get(False)
            except queue.Empty:
                return None
        elif time < 0:
            try:
                return self.in_queue.get(True)
            except queue.Empty:
                return None
        else:
            try:
                return self.in_queue.get(True, time)
            except queue.Empty:
                return None
86026
def getDateTimeFromGet(request,key):
    '''
    
    '''
    if request.GET.get(key,''):
        try:
            return ensure_timezone(datetime.strptime(unquote(request.GET.get(key,'')),'%Y-%m-%d'))
        except (ValueError, TypeError):
            pass
    return None
880344
def _get_time(header, keys, name):
        
        for key in keys:
            try:
                return _to_timestamp(header.pop(key))
            except KeyError:
                continue
        raise _UnsupportedOperation(name)
693484
def _StrftimeGm(value, unused_context, args):
    
    time_tuple = time.gmtime(value)
    return _StrftimeHelper(args, time_tuple)
227614
def timeit(metric, func, *args, **kwargs):
    
    return _client.timeit(metric, func, *args, **kwargs)
1245772
def GetTimeOfDay(self):
    
    normalized_timestamp = self._GetNormalizedTimestamp()
    if normalized_timestamp is None:
      return None, None, None

    _, hours, minutes, seconds = self._GetTimeValues(normalized_timestamp)
    return hours, minutes, seconds