File size: 748 Bytes
1bf41f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# -*- coding: utf-8 -*-
import time

def get_package_version() -> str:
    return '0.0.2'

class Stopwatch:
    """

    Stopwatch ็ตŒ้Žๆ™‚้–“ใ‚’่จˆๆธฌใ™ใ‚‹ใŸใ‚ใฎใ‚ฏใƒฉใ‚นใงใ™ใ€‚

    """

    def __init__(self):
        self._start_time = None
        self._elapsed = 0;

    @property
    def Elapsed(self):
        return self._elapsed

    def start(self) -> None:
        self._start_time = time.perf_counter()
        self._elapsed = 0;

    @classmethod
    def startNew(cls):
        stopwatch = Stopwatch()
        stopwatch.start()
        return stopwatch

    def stop(self):
        end_time = time.perf_counter()
        self._elapsed = end_time - self._start_time
        return self._elapsed