refactoring: startTime to start
Vladimir Bauer
1 year, 10 months ago
| 16 | 16 | // |
| 17 | 17 | // `style` one of [ET_STYLE_GO|ET_STYLE_HHMMSS|ET_STYLE_HHMM|ET_STYLE_MMSS] |
| 18 | 18 | // |
| 19 | // `startTime` start time | |
| 19 | // `start` start time | |
| 20 | 20 | // |
| 21 | 21 | // `wcc` optional WC config |
| 22 | func NewElapsed(style TimeStyle, startTime time.Time, wcc ...WC) Decorator { | |
| 22 | func NewElapsed(style TimeStyle, start time.Time, wcc ...WC) Decorator { | |
| 23 | 23 | var msg string |
| 24 | 24 | producer := chooseTimeProducer(style) |
| 25 | 25 | fn := func(s Statistics) string { |
| 26 | 26 | if !s.Completed { |
| 27 | msg = producer(time.Since(startTime)) | |
| 27 | msg = producer(time.Since(start)) | |
| 28 | 28 | } |
| 29 | 29 | return msg |
| 30 | 30 | } |