Commit c2870865 authored by Benjamin Summerton's avatar Benjamin Summerton

changed `newStopwatch()` to `stopwatch()`

parent 0d94aae9
......@@ -56,7 +56,7 @@ Simple usage:
```nim
import stopwatch
var sw = newStopwatch()
var sw = stopwatch()
sw.start()
# ... Long computation time
sw.stop()
......@@ -71,7 +71,7 @@ Using laps, record only the code you want to time:
import stopwatch
from sequtils import map
var sw = newStopwatch()
var sw = stopwatch()
# We're operating on a large image...
for y in countup(0, imgHeight - 1):
......
......@@ -23,7 +23,7 @@ type
laps: seq[Nanos]
# Basic stopwatch functionality
proc newStopwatch*(): Stopwatch
proc stopwatch*(): Stopwatch
proc clone*(sw: var Stopwatch): Stopwatch
proc running*(sw: var Stopwatch): bool {.inline.}
proc start*(sw: var Stopwatch) {.inline.}
......@@ -56,6 +56,8 @@ proc totalSecs*(sw: var Stopwatch): float {.inline.}
{.deprecated: [nanoseconds: nsecs].}
{.deprecated: [seconds: secs].}
# Deprecation for v1.0 -> v1.1
{.deprecated: [newStopwatch: stopwatch].}
......@@ -85,7 +87,7 @@ proc secs*(nsecs: int64): float =
#=====================#
## Creates a new Stopwatch. It has no laps and isn't running
proc newStopwatch*(): Stopwatch =
proc stopwatch*(): Stopwatch =
result = Stopwatch(
running: false,
startTicks: 0,
......@@ -193,7 +195,7 @@ proc lap*(sw: var Stopwatch; num: int; incCur: bool = false): int64 =
## with the `map()` function from the `sequtils` module. Example:
##
## .. code-block:: nim
## var sw = newStopwatch()
## var sw = stopwatch()
##
## # some time measurements later...
##
......
[Package]
name = "stopwatch"
version = "1.0"
version = "1.1"
author = "define-private-public"
description = "A fork of \"stopwatch\" that adds more features"
license = "MIT"
......
......@@ -3,7 +3,7 @@ from os import sleep
from sequtils import map
var sw = newStopwatch()
var sw = stopwatch()
echo "laps=", sw.laps(true)
echo "total=", sw.totalSecs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment