wintime

command module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2026 License: MIT Imports: 10 Imported by: 0

README

wintime

A Windows port of the Unix time command. Times any program's execution and prints real, user, and system CPU time — just like Linux time, with support for GNU-style format strings.


Installation

Option 1 — Download binary

Download wintime.exe from the latest release and place it anywhere on your PATH.

Option 2 — Go install

go install github.com/fermat-tech/wintime@latest

Usage

wintime [-f FORMAT] [-p] [--] COMMAND [ARGS...]

Run any command and wintime prints its timing to stderr after it finishes:

wintime ping -n 4 8.8.8.8
real    0m4.031s
user    0m0.000s
sys     0m0.016s

Use -- to prevent wintime from consuming flags intended for the timed command:

wintime -- myapp --verbose --output result.txt

Options

Option Description
-f FORMAT Output using FORMAT instead of the default (see below)
-p POSIX output: real/user/sys in decimal seconds, two places
-h, --help Show help

Format Strings

With -f FORMAT, wintime replaces % sequences with timing values.

Sequence Description Example
%% A literal % %
%C Command name and arguments ping -n 4 8.8.8.8
%e Elapsed real time, decimal seconds 4.031245
%E Elapsed real time as [H:]M:SS 0:04
%U User CPU time, decimal seconds 0.015625
%S System (kernel) CPU time, decimal seconds 0.031250
%P CPU percentage: (user+sys)/real * 100 1%
Examples
# Compact one-liner
wintime -f "%C took %es (cpu %P)" go build .

# POSIX-style
wintime -p go test ./...

# Just the wall clock
wintime -f "real: %E" some-long-script.ps1

Output

Timing output is always written to stderr. The timed program's own stdout and stderr pass through untouched, so wintime composes cleanly in pipelines:

wintime go build . 2>timing.txt

Notes

  • Rename-friendly: rename the .exe to anything and all messages reflect the new name.
  • Color: real/user/sys labels are bold in color terminals; respects the NO_COLOR environment variable.
  • Exit code: wintime exits with the same code as the timed command.

Building from Source

Requires Go 1.22+.

git clone https://github.com/fermat-tech/wintime.git
cd wintime
go build -o wintime.exe .

License

MIT

Documentation

Overview

Command wintime times the execution of a program and prints real, user, and system CPU time to stderr — a Windows port of the Unix time(1) command.

Installation

Download the binary from the latest release:

https://github.com/fermat-tech/wintime/releases/latest

Or install with Go:

go install github.com/fermat-tech/wintime@latest

Usage

wintime [-f FORMAT] [-p] [--] COMMAND [ARGS...]

With no options the output matches GNU time's default format:

real    0m1.234s
user    0m0.015s
sys     0m0.031s

The -f flag accepts a GNU-time-style format string. Supported specifiers: %% literal percent, %C command and args, %e real seconds (decimal), %E real time as [H:]M:SS, %U user seconds, %S sys seconds, %P CPU percentage.

The -p flag selects POSIX output (decimal seconds, two places).

wintime exits with the same exit code as the timed command.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL