Closed Sorunome closed 8 years ago
For all messages? Try in terminal: python3 import time print(time.strftime('%H:%M')) Does it show current time?
Yes, for all messages. Manually running pythons time function does display the correct time as expected.
Does it show incorrect time right after message appearance or later, after switching friends?
On both, all the time
Can you try:
import time
t = time.time()
sec = int(t) - time.timezone
m, s = divmod(sec, 60)
h, m = divmod(m, 60)
d, h = divmod(h, 24)
s = '%02d:%02d' % (h, m)
print(s)
That gives the weird time which toxygen displays, the one that is one hour off from the correct one.
The issue seems to me being time.timezone here, it seems to be ignoring sumer / wintertime, time.timezone returns -3600 for me, while during the sumertime we are actually 2h away from UTC, not just 1h
Yes, timezone produces error. What about
import time
t = time.time()
offset = time.timezone if (time.localtime().tm_isdst == 0) else time.altzone
sec = int(t) + offset
m, s = divmod(sec, 60)
h, m = divmod(m, 60)
d, h = divmod(h, 24)
s = '%02d:%02d' % (h, m)
print(s)
That is even more off.
time.daylight appears to be return 1 if there are currently daylight saving times, which means it requires an additional hour offset. (else it appears to return zero)
According to the docs time.timezone only gives the offset without daylight saving time
offset = time.timezone if not time.daylight else time.timezone - 3600 should fix this bug
why not
offset = time.timezone - time.daylight*3600
Also good if time.daylight is int or bool. Fix is coming
It appears to be int
Fixed in develop
Toxygen has some timezone stuff off......
example:
While toxygen displays as 17:31