Esempio n. 1
0
    def func(self):
        "Show times."

        table = [["Current server uptime:",
                  "Total server running time:",
                  "Total in-game time (realtime x %g):" % (gametime.TIMEFACTOR),
                  "Server time stamp:"
                  ],
                 [utils.time_format(time.time() - SESSIONS.server.start_time, 3),
                  utils.time_format(gametime.runtime(format=False), 2),
                  utils.time_format(gametime.gametime(format=False), 2),
                  datetime.datetime.now()
                  ]]
        if utils.host_os_is('posix'):
            loadavg = os.getloadavg()
            table[0].append("Server load (per minute):")
            table[1].append("%g" % (loadavg[0]))
        stable = []
        for col in table:
            stable.append([str(val).strip() for val in col])
        ftable = utils.format_table(stable, 5)
        string = ""
        for row in ftable:
            string += "\n " + "{w%s{n" % row[0] + "".join(row[1:])
        self.caller.msg(string)
Esempio n. 2
0
 def func(self):
     "Show server time data in a table."
     table = prettytable.PrettyTable(["{wserver time statistic","{wtime"])
     table.align = 'l'
     table.add_row(["Current server uptime", utils.time_format(gametime.uptime(), 3)])
     table.add_row(["Total server running time", utils.time_format(gametime.runtime(), 2)])
     table.add_row(["Total in-game time (realtime x %g" % (gametime.TIMEFACTOR), utils.time_format(gametime.gametime(), 2)])
     table.add_row(["Server time stamp", datetime.datetime.now()])
     self.caller.msg(str(table))
Esempio n. 3
0
 def func(self):
     "Show server time data in a table."
     table = prettytable.PrettyTable(["{wserver time statistic","{wtime"])
     table.align = 'l'
     table.add_row(["Current server uptime", utils.time_format(gametime.uptime(), 3)])
     table.add_row(["Total server running time", utils.time_format(gametime.runtime(), 2)])
     table.add_row(["Total in-game time (realtime x %g" % (gametime.TIMEFACTOR), utils.time_format(gametime.gametime(), 2)])
     table.add_row(["Server time stamp", datetime.datetime.now()])
     self.caller.msg(str(table))