import time,datetime
def et(stamp=None):
"""Calculate Eorzea time from a UTC+0 Unixtimestamp. datetime.datetime.utcnow() is preferred, time.time() is not timezone neutral
Returns a six-tuple containing year, month, day, hour, minute and seconds"""
ratio = 20.571428571428573
utc = stamp
epoch = datetime.datetime(year=2010, month=7, day=12, hour=0, minute=0, second=0)
jptime = utc + (9*60*60)
epoch = time.mktime(epoch.timetuple())
diff = jptime - epoch
diff -= 90000
delta = (diff * ratio)
gameSecond = int((delta % 60)) | 0
delta -= gameSecond
delta /= 60.0
gameMinute = int((delta % 60)) | 0
delta -= gameMinute
delta /= 60.0
gameHour = int((delta % 24)) | 0
delta -= gameHour
delta /= 24.0
gameDay = int((delta % 32)) | 0
delta -= gameDay
delta /= 32.0
gameMonth = int((delta % 12)) | 0
delta -= gameMonth
delta /= 12.0
gameYear = int(delta) | 0
gameDay += 2
gameMonth += 1
gameMinute += 1
if gameMinute == 60:
gameHour += 1
gameMinute = 0
if gameDay == 33:
gameDay = 1
elif gameDay == 34:
gameDay = 2
return(int(gameYear), int(gameMonth), int(gameDay), int(gameHour), int(gameMinute), int(gameSecond))
def eth(values=None):
"""Human-redable parser for eorzea.et. Returns a string that contains the current Eorzea hour, minute, second, along with the current date"""
gameYear, gameMonth, gameDay, gameHour, gameMinute, gameSecond = values
return("Eorzea time: %s:%s:%s (%s.%s.%s)" %
("0" + str(gameHour) if len(str(gameHour)) == 1 else gameHour,
"0" + str(gameMinute) if len(str(gameMinute)) == 1 else gameMinute,
"0" + str(gameSecond) if len(str(gameSecond)) == 1 else gameSecond,
gameYear,
"0" + str(gameMonth) if len(str(gameMonth)) == 1 else gameMonth,
"0" + str(gameDay) if len(str(gameDay)) == 1 else gameDay))
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"text\/x-go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"mysql","xml":"xml","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","ecmascript":"javascript","groovy":"text\/x-groovy","haskell":"text\/x-haskell","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mysql":"mysql","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"plsql","properties":"text\/x-properties","scheme":"text\/x-scheme","vb":"text\/vbscript","vbnet":"text\/vbscript","verilog":"text\/x-verilog","yaml":"text\/x-yaml"}