

def updateuptime(self, server):
    now = time.mktime(datetime.datetime.now().timetuple())
    servercameback = time.mktime(server.timeservercameback.timetuple())
    difference = (now - servercameback)
    MINUTE = 60
    HOUR = (MINUTE * 60)
    DAY = (HOUR * 24)
    days = int((difference / DAY))
    hours = int(((difference % DAY) / HOUR))
    minutes = int(((difference % HOUR) / MINUTE))
    seconds = int((difference % MINUTE))
    string = ''
    if (days > 0):
        string += (((str(days) + ' ') + (((days == 1) and 'day') or 'days')) + ', ')
    if ((len(string) > 0) or (hours > 0)):
        string += (((str(hours) + ' ') + (((hours == 1) and 'hour') or 'hours')) + ', ')
    if ((len(string) > 0) or (minutes > 0)):
        string += (((str(minutes) + ' ') + (((minutes == 1) and 'minute') or 'minutes')) + ', ')
    string += ((str(seconds) + ' ') + (((seconds == 1) and 'second') or 'seconds'))
    server.uptime = string
    server.put()

dataset/ETHPy150Open infincia/AEServmon/checkservers.py CheckServers.updateuptime/original