def _a_zc2t(t): # (y m d H M [S tz dst...]) or (tjd sec [tz dst]) if t.n==0: return time.time() if t.n==3: return (t[0]-587)*864e2 + t[1] - _norm_tz(t[2]) if t.n==4: return (t[0]-587)*864e2 + t[1] - _norm_tz(t[2]) - _norm_tz(t[3]) if t.n==2: return (t[0]-587)*864e2 + t[1] + time.timezone - _norm_tz(time.daylight) if t.n==1: assert False,"t must be empty, or 2..4 items of CT, or 5..8+ items of ZT" ymd,t = t[:3],list(t[3:]) if t.n==2: t.append(0) if t.n==3: t += [-time.timezone,time.daylight] hms,tz,dst = t[:3],t[3],0 if t.n>4: dst = t[4] return (ymd2dn(*ymd)-587)*864e2 + _bt_hms2i(hms) - (_norm_tz(tz)+_norm_tz(dst))
def _bt_s2dn(x): # 3 ints in x! if x=="": return ymd2dn(*time.localtime()[:3]) return ymd2dn(*x.ints.abs)
def _bt_ymd2dt(x): if not x: return ymd2dn(*time.localtime()[:3]) return ymd2dn(*x)