Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Unix time command for Windows — times program execution, prints real/user/sys, supports GNU-style format strings

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages