1.存入数据库前转换为utc时间。

This commit is contained in:
facat 2019-06-18 22:55:26 +08:00
parent 22b24c28b4
commit dcc7f3d186
1 changed files with 2 additions and 2 deletions

View File

@ -7,10 +7,10 @@ mysql_db = MySQLDatabase(
def add_record(execution_datetime,server, speed):
execution_datetime_timestamp = execution_datetime.strftime("%Y-%m-%d %H:%M:%S")
execution_datetime_utc = execution_datetime-datetime.timedelta(hours=8)#转换为UTC时间。
# print(now_timestamp)
mysql_db.execute_sql(
'insert into vps_download_speed(server,speed,datetime) values("{server}",{speed},"{datetime}")'.format(
server=server, speed=speed, datetime=execution_datetime_timestamp
server=server, speed=speed, datetime=execution_datetime_utc
)
)