Skip to content
This repository has been archived by the owner on Sep 15, 2019. It is now read-only.

Standardise uptime #28

Closed
TechWhizZ199 opened this issue Jun 22, 2016 · 1 comment
Closed

Standardise uptime #28

TechWhizZ199 opened this issue Jun 22, 2016 · 1 comment

Comments

@TechWhizZ199
Copy link

I was wondering, maybe uptime as an information variable should be a standard in the library. The library itself has a the ability to make a connection. If this was the case, even when integrating with something like the bot, all the bot would have to do would be to interpret the uptime.

The uptime does not have to be given in a particular format, maybe just plainly as seconds or raw time.time(). Any other application using the library can interpret it in the way it wants. You usually see client connection or actual uptime as default information on a variety of interfaces now, so I was placing the idea.

@nortxort
Copy link
Owner

    def get_runtime(self, milliseconds=True):
        """
        Get the time the connection has been alive.
        :param milliseconds: bool True return the time as milliseconds, False return seconds.
        :return: int milliseconds or seconds.
        """
        up = int(time.time() - self._init_time)
        if milliseconds:
            return up * 1000
        return up

Will be in next version.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants