mirror of
https://github.com/daylinmorgan/oizys.git
synced 2025-01-22 07:07:32 -06:00
make duration more readable
This commit is contained in:
parent
00c93702ad
commit
d49948eae3
1 changed files with 14 additions and 8 deletions
|
@ -324,7 +324,13 @@ type
|
||||||
duration*: Duration
|
duration*: Duration
|
||||||
successful*: bool
|
successful*: bool
|
||||||
|
|
||||||
|
func formatDuration(d: Duration): string =
|
||||||
|
## convert duration to: X minutes and Y seconds
|
||||||
|
let seconds = d.inSeconds
|
||||||
|
if seconds > 60:
|
||||||
|
result.add $(seconds div 60) & " minutes"
|
||||||
|
result.add " and "
|
||||||
|
result.add $(seconds mod 60) & " seconds"
|
||||||
|
|
||||||
proc build(drv: OizysDerivation, rest: seq[string]): BuildResult =
|
proc build(drv: OizysDerivation, rest: seq[string]): BuildResult =
|
||||||
let startTime = now()
|
let startTime = now()
|
||||||
|
@ -337,7 +343,7 @@ proc build(drv: OizysDerivation, rest: seq[string]): BuildResult =
|
||||||
result.duration = now() - startTime
|
result.duration = now() - startTime
|
||||||
# TODO: make splitDrv more ergonmic?
|
# TODO: make splitDrv more ergonmic?
|
||||||
info "succesfully built: " & splitDrv(drv.name).name
|
info "succesfully built: " & splitDrv(drv.name).name
|
||||||
info "-> duration: " & $result.duration
|
info "-> duration: " & formatDuration(result.duration)
|
||||||
|
|
||||||
func outputsPaths(o: OizysDerivation): seq[string] =
|
func outputsPaths(o: OizysDerivation): seq[string] =
|
||||||
for _, output in o.drv.outputs:
|
for _, output in o.drv.outputs:
|
||||||
|
|
Loading…
Reference in a new issue