def gmtime(t=None): if t == None: t = time() date = JS("new Date(t*1000)") tm = struct_time() tm.tm_year = date.getUTCFullYear() tm.tm_mon = date.getUTCMonth() + 1 tm.tm_mday = date.getUTCDate() tm.tm_hour = date.getUTCHours() tm.tm_min = date.getUTCMinutes() tm.tm_sec = date.getUTCSeconds() tm.tm_wday = (date.getUTCDay() + 6) % 7 startOfYear = int((JS("new Date(tm.tm_year,0,1)").getTime()) / 1000) tm.tm_yday = 1 + int((t - startOfYear) / 86400) tm.tm_isdst = 0 return tm
def gmtime(t=None): if t is None: t = time() date = JS("new Date(@{{t}}*1000)") tm = struct_time() tm_year = tm.tm_year = int(date.getUTCFullYear()) tm.tm_mon = int(date.getUTCMonth()) + 1 tm.tm_mday = int(date.getUTCDate()) tm.tm_hour = int(date.getUTCHours()) tm.tm_min = int(date.getUTCMinutes()) tm.tm_sec = int(date.getUTCSeconds()) tm.tm_wday = (int(date.getUTCDay()) + 6) % 7 tm.tm_isdst = 0 startOfYear = JS("new Date('Jan 1 '+ @{{tm_year}} +' GMT+0000')") tm.tm_yday = 1 + int((t - startOfYear.getTime()/1000)/86400) return tm
def gmtime(t=None): if t == None: t = time() date = JS("new Date(@{{t}}*1000)") tm = struct_time() tm_year = tm.tm_year = int(date.getUTCFullYear()) tm.tm_mon = int(date.getUTCMonth()) + 1 tm.tm_mday = int(date.getUTCDate()) tm.tm_hour = int(date.getUTCHours()) tm.tm_min = int(date.getUTCMinutes()) tm.tm_sec = int(date.getUTCSeconds()) tm.tm_wday = (int(date.getUTCDay()) + 6) % 7 tm.tm_isdst = 0 startOfYear = JS("new Date('Jan 1 '+ @{{tm_year}} +' GMT+0000')") tm.tm_yday = 1 + int((t - startOfYear.getTime() / 1000) / 86400) return tm