
Command
/stopwatch
Creates, reads, restarts and removes named stopwatches that measure real time.
| /stopwatch (create <id>|remove <id>|restart <id>) |
| /stopwatch query <id> [<scale>] |
| Argument | Kind of value | What to type |
|---|---|---|
| <id> | Id | The name of the stopwatch, written as an id such as race or mypack:race. Without a namespace, minecraft is used. |
| <scale> | Decimal number | A decimal number the elapsed seconds are multiplied by to form the number /execute store saves of query. Defaults to 1. |
| Permission level | 2: operators, worlds with cheats on, command blocks and functions |
| Works in | Singleplayer with cheats enabled, multiplayer servers, command blocks and functions. Needs permission level 2 (gamemasters): operators, players in a world with cheats enabled, command blocks and functions. |
| Result | create reports "Created stopwatch '<id>'", restart reports "Restarted stopwatch '<id>'" and remove reports "Removed stopwatch '<id>'"; each returns 1. query reports "Stopwatch '<id>' has run for N s" and returns the elapsed seconds multiplied by the scale, cut down to a whole number. |
| create | Creates a stopwatch with the given id and starts it at once. Fails with "Stopwatch '<id>' already exists" if the id is in use. |
| query | Shows how many seconds the stopwatch has run. The optional scale multiplies the seconds for the number /execute store saves only: the default 1 returns whole seconds, 20 returns the time in ticks, 1000 returns milliseconds. |
| restart | Sets the stopwatch back to zero and lets it run on. |
| remove | Deletes the stopwatch. |
| Unknown id | query, restart and remove fail with "Stopwatch '<id>' does not exist" if there is no stopwatch with that id. |
| Real time | Stopwatches count real seconds, not game ticks, so they are not slowed down by lag or by /tick. They are stored with the world, and the time already counted is kept when the world is closed and reopened. |
/stopwatch create raceCreates a stopwatch named race and starts it.
/stopwatch query raceShows how many seconds the stopwatch race has run.
/stopwatch query race 20Shows the time and returns it in ticks, for use with /execute store.
/stopwatch restart raceSets the stopwatch race back to zero.
/stopwatch remove raceDeletes the stopwatch race.

