Create a Python class named StopWatch
. This class implements a simple stopwatch functionality to measure elapsed time. It includes methods to start the stopwatch, stop it, and retrieve the elapsed time in milliseconds.
The StopWatch
class includes the following methods:
The constructor initializes the StopWatch
object and automatically starts the timer by calling the start()
method
get_start_time()
Returns the time when the stopwatch was started.
get_end_time()
Returns the time when the stopwatch was stopped.
start()
Starts the stopwatch by recording the current time.
stop()
Stops the stopwatch by recording the current time.
get_elapsed_time()
Calculates and returns the elapsed time between starting and stopping the stopwatch, measured in milliseconds.
time()
from the time
library to keep track of the time.