Lena wants to create a simple stopwatch using Go. To do this, she has created the Stopwatch struct; it has two fields start and end of the time.Time type that will allow her to track time on her stopwatch.
Now Lena wants to create a few methods to make her stopwatch properly track time in her Go program:
Start()andEnd()— To make thes.startands.endfields equal totime.Now()TimeElapsed()— It should return the time elapsed by subtractings.startfroms.endby calling thes.end.Sub()method and passing to it thes.starttime as an argument.
Tip: You can obtain the time elapsed via the s.end.Sub(s.start) statement.