Ejemplo n.º 1
0
 def runTest(self):
     self.assertEqual(0, time.mktime(time.localtime(0)))
     for tibtime, unixtime in (
                 ("Jan 01 1970, 10:00:00 CET", 9 * 3600),
                 ("Jan 01 1970, 01:00:00 CET", 0),
                 (   time.strftime("%b %d %Y, %H:%M:%S CET", time.gmtime(int(time.time()+3600))),
                     int(time.time())),
             ):
         self.assertEqual(unixtime, tibia_time_to_unix(tibtime))
     skeletor = char_info("Skeletor the Vicious")
     self.assertEqual(1064301567, tibia_time_to_unix(skeletor["created"]))
Ejemplo n.º 2
0
def to_unixepoch(value):
    try:
        return int(value)
    except ValueError:
        pass
    try:
        return tibia_time_to_unix(value)
    except ValueError:
        pass
    try:
        return calendar.timegm(time.strptime(value, "%a, %d %b %Y %H:%M:%S %Z"))
    except ValueError:
        pass
    assert False, value # uh oh...
Ejemplo n.º 3
0
def to_unixepoch(value):
    try:
        return int(value)
    except ValueError:
        pass
    try:
        return tibia_time_to_unix(value)
    except ValueError:
        pass
    try:
        return calendar.timegm(time.strptime(value,
                                             "%a, %d %b %Y %H:%M:%S %Z"))
    except ValueError:
        pass
    assert False, value  # uh oh...
Ejemplo n.º 4
0
def pz_end(deathRow):
    return tibia_time_to_unix(deathRow["stamp"]) + ((16 * 60) if deathRow["lasthit"] else 60)
Ejemplo n.º 5
0
def pz_end(deathRow):
    return tibia_time_to_unix(deathRow["stamp"]) + (
        (16 * 60) if deathRow["lasthit"] else 60)