def IsPacificDST(now):
 pst = time.gmtime(now)
 year = pst[0]
 assert (year >= 2007)
 begin = calendar.timegm((year, 3, 8, 2, 0, 0, 0, 0, 0))
 while (time.gmtime(begin).tm_wday != SUNDAY):
  begin += DAY
 end = calendar.timegm((year, 11, 1, 2, 0, 0, 0, 0, 0))
 while (time.gmtime(end).tm_wday != SUNDAY):
  end += DAY
 return (begin <= now < end)

def IsPacificDST ( now ) : pst = time . gmtime ( now ) year = pst [ 0 ] assert ( year >= 2007 ) begin = calendar . timegm ( ( year , 3 , 8 , 2 , 0 , 0 , 0 , 0 , 0 ) ) while ( time . gmtime ( begin ) . tm_wday != SUNDAY ) : begin += DAY end = calendar . timegm ( ( year , 11 , 1 , 2 , 0 , 0 , 0 , 0 , 0 ) ) while ( time . gmtime ( end ) . tm_wday != SUNDAY ) : end += DAY return ( begin <= now < end )
helper for pacifictime to decide whether now is pacific dst .