Refine msgpack usage for datetime

This commit is contained in:
DingZQ
2025-04-04 10:56:40 +08:00
parent 2f14395d1e
commit b8deadbd11
2 changed files with 48 additions and 40 deletions

View File

@@ -1823,7 +1823,7 @@ def query_all_record_by_time_property(query_time: str, type: str, property: str,
# 2025/02/21
def query_all_record_by_date(query_date: str, bucket: str="realtime_simulation_result") -> tuple:
def query_all_records_by_date(query_date: str, bucket: str="realtime_simulation_result") -> tuple:
"""
查询指定日期的所有记录包括nodelink分别以指定的格式返回
:param query_date: 输入的日期格式为2025-02-14
@@ -1834,7 +1834,7 @@ def query_all_record_by_date(query_date: str, bucket: str="realtime_simulation_r
# 记录开始时间
time_cost_start = time.perf_counter()
print('{} -- query_all_record_by_date started.'.format(datetime.now(pytz.timezone('Asia/Shanghai')).strftime('%Y-%m-%d %H:%M:%S')))
print('{} -- query_all_records_by_date started.'.format(datetime.now(pytz.timezone('Asia/Shanghai')).strftime('%Y-%m-%d %H:%M:%S')))
if not client.ping():
print("{} -- Failed to connect to InfluxDB.".format(datetime.now().strftime('%Y-%m-%d %H:%M:%S')))
@@ -1895,7 +1895,7 @@ def query_all_record_by_date(query_date: str, bucket: str="realtime_simulation_r
})
time_cost_end = time.perf_counter()
print('{} -- query_all_record_by_date finished, cost time: {:.2f} s.'.format( datetime.now(pytz.timezone('Asia/Shanghai')).strftime('%Y-%m-%d %H:%M:%S'), time_cost_end - time_cost_start))
print('{} -- query_all_records_by_date finished, cost time: {:.2f} s.'.format( datetime.now(pytz.timezone('Asia/Shanghai')).strftime('%Y-%m-%d %H:%M:%S'), time_cost_end - time_cost_start))
client.close()