time module

Marko Rauhamaa marko at pacujo.net
Sun Nov 8 06:05:02 EST 2015


input/ldompeling at casema.nl:

> Yes, I would like seconds since start of program.
> Can I not doing something like time()=0 only this gives an error.

Here:

    class MyReckoning:
        def __init__(self):
            self.the_beginning = time.time()

        def time(self):
            return time.time() - self.the_beginning

    reckoning = MyReckoning()
    print(reckoning.time())


Marko



More information about the Python-list mailing list