获取客服聊天记录

        :param start_time: 查询开始时间，UNIX 时间戳
        :param end_time: 查询结束时间，UNIX 时间戳，每次查询不能跨日查询
        :param msgid: 消息id顺序从小到大，从1开始
        :param number: 每次获取条数，最多10000条

        :return: 返回的 JSON 数据包
762303
def get_records(self, start_time, end_time, msgid=1,
                    number=10000):
        
        if isinstance(start_time, datetime.datetime):
            start_time = time.mktime(start_time.timetuple())
        if isinstance(end_time, datetime.datetime):
            end_time = time.mktime(end_time.timetuple())
        record_data = {
            'starttime': int(start_time),
            'endtime': int(end_time),
            'msgid': msgid,
            'number': number
        }
        res = self._post(
            'https://api.weixin.qq.com/customservice/msgrecord/getmsglist',
            data=record_data,
        )
        return res
1089464
def get_timerange(self, start, end, code=None):
        
        try:
            return self.data.loc[(slice(pd.Timestamp(start), pd.Timestamp(end)), slice(code)), :]
        except:
            return ValueError('CANNOT FOUND THIS TIME RANGE')
1043712
def ping(self):
        
        start = time.time()
        self._conn.ping()
        return (time.time() - start)
939156
def caldata(self, time):
        ''' 
        '''
        if time.date() in self.__ocdate['close']:  # 判對是否為法定休市
            return False
        elif time.date() in self.__ocdate['open']:  # 判對是否為法定開市
            return True
        else:
            if time.weekday() <= 4:  # 判斷是否為平常日開市
                return True
            else:
                return False
837872
public static String printTiming(long start, long end) {
    long totalMillis = end - start;
    long mins = TimeUnit.MILLISECONDS.toMinutes(totalMillis);
    long secs = TimeUnit.MILLISECONDS.toSeconds(totalMillis) - TimeUnit.MINUTES.toSeconds(mins);
    long millis =
        TimeUnit.MILLISECONDS.toMillis(totalMillis) - TimeUnit.MINUTES.toMillis(mins) - TimeUnit.SECONDS.toMillis(secs);
    return String.format("%d min, %d sec, %d millis", mins, secs, millis);
  }
698258
def rnd_date_array(self, size, start=date(1970, 1, 1), end=date.today()):
        
        if isinstance(start, string_types):
            start = self.str2date(start)
        if isinstance(end, string_types):
            end = self.str2date(end)
        if start > end:
            raise ValueError("start time has to be earlier than end time")

        return self.randn(size, self._rnd_date, start, end)
572698
def unix_time(self, end_datetime=None, start_datetime=None):
        
        start_datetime = self._parse_start_datetime(start_datetime)
        end_datetime = self._parse_end_datetime(end_datetime)
        return self.generator.random.randint(start_datetime, end_datetime)
170148
function getHrTimeDurationInMs (startTime, endTime) {
    if (startTime === null || endTime === null) {
        return null;
    }

    var secondDiff = endTime[0] - startTime[0];
    var nanoSecondDiff = endTime[1] - startTime[1];
    var diffInNanoSecond = secondDiff * NS_PER_SEC + nanoSecondDiff;

    return Math.round(diffInNanoSecond / MS_PER_NS);
}
822649
def get_jids():
    '''
    
    '''
    ret = {}
    for jid, job, _, _ in _walk_through(_job_dir()):
        ret[jid] = salt.utils.jid.format_jid_instance(jid, job)

        if __opts__.get('job_cache_store_endtime'):
            endtime = get_endtime(jid)
            if endtime:
                ret[jid]['EndTime'] = endtime

    return ret
1361491
def get_end_date_metadata(self):
        
        metadata = dict(self._end_date_metadata)
        metadata.update({'existing_date_time_values': self.my_osid_object_form._my_map['endDate']})
        return Metadata(**metadata)
447795
def _get_new_msg_id(self):
        
        now = time.time() + self.time_offset
        nanoseconds = int((now - int(now)) * 1e+9)
        new_msg_id = (int(now) << 32) | (nanoseconds << 2)

        if self._last_msg_id >= new_msg_id:
            new_msg_id = self._last_msg_id + 4

        self._last_msg_id = new_msg_id
        return new_msg_id
1114050
def get_start_date(self):
        
        sdate = self._my_map['startDate']
        return DateTime(
            sdate.year,
            sdate.month,
            sdate.day,
            sdate.hour,
            sdate.minute,
            sdate.second,
            sdate.microsecond)
712744
def date_time_ad(self, tzinfo=None, end_datetime=None, start_datetime=None):
        

        # 1970-01-01 00:00:00 UTC minus 62135596800 seconds is
        # 0001-01-01 00:00:00 UTC.  Since _parse_end_datetime() is used
        # elsewhere where a default value of 0 is expected, we can't
        # simply change that class method to use this magic number as a
        # default value when None is provided.

        start_time = -62135596800 if start_datetime is None else self._parse_start_datetime(start_datetime)
        end_datetime = self._parse_end_datetime(end_datetime)

        ts = self.generator.random.randint(start_time, end_datetime)
        # NOTE: using datetime.fromtimestamp(ts) directly will raise
        #       a "ValueError: timestamp out of range for platform time_t"
        #       on some platforms due to system C functions;
        #       see http://stackoverflow.com/a/10588133/2315612
        # NOTE: On windows, the lowest value you can get from windows is 86400
        #       on the first day. Known python issue:
        #       https://bugs.python.org/issue30684
        return datetime(1970, 1, 1, tzinfo=tzinfo) + timedelta(seconds=ts)
245977
def QA_fetch_future_min_adv(
        code,
        start, end=None,
        frequence='1min',
        if_drop_index=True,
        collections=DATABASE.future_min):
    '''
    
    '''
    if frequence in ['1min', '1m']:
        frequence = '1min'
    elif frequence in ['5min', '5m']:
        frequence = '5min'
    elif frequence in ['15min', '15m']:
        frequence = '15min'
    elif frequence in ['30min', '30m']:
        frequence = '30min'
    elif frequence in ['60min', '60m']:
        frequence = '60min'

    # __data = [] 没有使用

    end = start if end is None else end
    if len(start) == 10:
        start = '{} 00:00:00'.format(start)
    if len(end) == 10:
        end = '{} 15:00:00'.format(end)

    # 🛠 todo 报告错误 如果开始时间 在 结束时间之后

    # if start == end:
    # 🛠 todo 如果相等，根据 frequence 获取开始时间的 时间段 QA_fetch_index_min_adv， 不支持start end是相等的
    #print("QA Error QA_fetch_index_min_adv parameter code=%s , start=%s, end=%s is equal, should have time span! " % (code, start, end))
    # return None

    res = QA_fetch_future_min(
        code, start, end, format='pd', frequence=frequence)
    if res is None:
        print("QA Error QA_fetch_future_min_adv parameter code=%s start=%s end=%s frequence=%s call QA_fetch_future_min return None" % (
            code, start, end, frequence))
    else:
        res_reset_index = res.set_index(
            ['datetime', 'code'], drop=if_drop_index)
        # if res_reset_index is None:
        #     print("QA Error QA_fetch_index_min_adv set index 'date, code' return None")
        return QA_DataStruct_Future_min(res_reset_index)
776879
def start_time(self):
        
        resource_list = self.traffic_incident()
        start_time = namedtuple('start_time', 'start_time')
        if len(resource_list) == 1 and resource_list[0] is None:
            return None
        else:
            try:
                return [start_time(resource['start'])
                        for resource in resource_list]
            except (KeyError, TypeError):
                return [start_time(resource['StartTimeUTC'])
                        for resource in resource_list]
69982
def parse_start_date(self, request):
        
        if request.GET.get('start_date'):
            try:
                return djtz.parse('%s 00:00' % request.GET.get('start_date'))
            except ValueError:
                pass
        return self.default_start_date or djtz.midnight()
626240
def get_start_date_metadata(self):
        
        metadata = dict(self._mdata['start_date'])
        metadata.update({'existing_date_time_values': self._my_map['startDate']})
        return Metadata(**metadata)