gcdsss 最近的时间轴更新
gcdsss

gcdsss

V2EX 第 648152 号会员,加入于 2023-09-12 15:22:53 +08:00
今日活跃度排名 4307
gcdsss 最近回复了
4 小时 42 分钟前
回复了 punching2012 创建的主题 旅行 已裸辞, 3 月份准备日本旅行, 有没有什么注意的
刚从那回来,注意地铁交通,跟着谷歌地图去看, 西瓜卡覆盖城市地铁,新干线快速线去 klook 上买
8 小时 53 分钟前
回复了 fine886 创建的主题 职场话题 劳动仲裁后续
打赢不难,执行难
1 天前
回复了 lanweizhujiao 创建的主题 游戏 有没有巨好玩的游戏推荐
塞尔达旷野, 近几年唯一治好了我电子阳痿
我踩过坑,解决方法,写一个多线程兼容的 handler 去处理

`
class MultiCompatibleTimedRotatingFileHandler(TimedRotatingFileHandler):
def doRollover(self):
if self.stream:
self.stream.close()
self.stream = None
# get the time that this sequence started at and make it a TimeTuple
currentTime = int(time.time())
dstNow = time.localtime(currentTime)[-1]
t = self.rolloverAt - self.interval
if self.utc:
timeTuple = time.gmtime(t)
else:
timeTuple = time.localtime(t)
dstThen = timeTuple[-1]
if dstNow != dstThen:
if dstNow:
addend = 3600
else:
addend = -3600
timeTuple = time.localtime(t + addend)
dfn = self.baseFilename + "." + time.strftime(self.suffix, timeTuple)
# 兼容多进程并发 LOG_ROTATE
if not os.path.exists(dfn):
f = open(self.baseFilename, "a")
fcntl.lockf(f.fileno(), fcntl.LOCK_EX)
if not os.path.exists(dfn):
os.rename(self.baseFilename, dfn) # 释放锁 释放老 log 句柄
f.close()
if self.backupCount > 0:
for s in self.getFilesToDelete():
os.remove(s)
if not self.delay:
self.stream = self._open()
newRolloverAt = self.computeRollover(currentTime)
while newRolloverAt <= currentTime:
newRolloverAt = newRolloverAt + self.interval
# If DST changes and midnight or weekly rollover, adjust for this.
if (self.when == "MIDNIGHT" or self.when.startswith("W")) and not self.utc:
dstAtRollover = time.localtime(newRolloverAt)[-1]
if dstNow != dstAtRollover:
if (
not dstNow
): # DST kicks in before next rollover, so we need to deduct an hour
addend = -3600
else: # DST bows out before next rollover, so we need to add an hour
addend = 3600
newRolloverAt += addend
self.rolloverAt = newRolloverAt
`
自己调节,没有谁有义务去承受你的负能量,伴侣如果不理解你的话也没法,自己想办法去调节吧
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3764 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 11ms · UTC 10:28 · PVG 18:28 · LAX 02:28 · JFK 05:28
Developed with CodeLauncher
♥ Do have faith in what you're doing.