qt5 - QDateTime usage in my Qt project causing issue during Daylight Savings? -


i have created project read data before , after event.

for example: let d1, d2, d3 qdatetime objects:
let d1 1 value of 2014-03-09t2:30:00.
let d2 1 value of 2014-03-09t1:30:00.
let d3 1 value of 2014-03-09t3:30:00.

d1.date() return qdate(2014,3,9). d1.time() return qtime(2,30). d1.tostring() return “”. (d1 > d2) true. (d1 < d2) false. (d1 > d3) false. (d1 < d3) true. (d1 == d1) true. d1.secsto(x) 0. x.secsto(d1) 0, x. 

in case, d1.secsto(x) used calculate reports 1:00 am. dst effect occurs between 2-3 am.

what need correct transition?

the documentation claims qdatetime class should handle dst automatically, appears bug in qt. tried inputs provided, , got 0 secsto() method if either time between 2-3 am. provided correct offset if changed times after 3 am.

for example:

d1 = 2:30 d2 = 2:45 d1.secsto(d2) gives 0  d1 = 3:30 d2 = 3:45 d1.secsto(d2) gives 900 

i filed bug report.

edit

your current solution should work once bug fixed. solution meantime convert timestamps utc before doing calculations. qdatetime class has toutc() method. think should avoid dst problems completely.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -