C#的DateTime之间相减,得到的数值完全符合逻辑,但是python的就反常。
import time
import datetime
dttm1 = datetime.datetime(1971, 1, 1, 0, 0, 20)
dttm2 = datetime.datetime(1971, 1, 1, 0, 0, 40)
tm1 = time.mktime(dttm1.timetuple())
tm2 = time.mktime(dttm2.timetuple())
td = dttm1 - dttm2
print("type=[{}],td=[{}],deltaSeconds=[{}]".format(type(td), td, td.seconds))
# type=[<class 'datetime.timedelta'>],td=[-1 day, 23:59:40],deltaSeconds=[86380]
print(tm1 - tm2)
# -20.0
完。