Skip to content

ivosetyadi/gnutime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ•’ gnutime

A lightweight Windows 64-bit port of the GNU time utility โ€” built using Visual Studio x64 Native Build Tools. This version replicates core time features such as real, user, and sys timing for any command-line process, and adds support for GNU-style formatting (-f) and output redirection (-o).

โ—This is not /usr/bin/time, but a compatible reimplementation targeted at native Windows users โ€” no WSL, MSYS2, or Cygwin required.


โœจ Features

  • โœ… Native Windows 64-bit executable (no dependencies)
  • โœ… Launches external programs and reports:
    • real: wall clock time
    • user: CPU time in user mode
    • sys: CPU time in kernel mode
  • โœ… GNU-compatible formatting via -f (supports %e, %U, %S)
  • โœ… Output redirection via -o filename
  • โœ… Forwards child process exit code

๐Ÿ“ฆ Compilation Instructions (Visual Studio)

You must have Microsoft Visual Studio Build Tools (2019 or 2022) installed.

๐Ÿ”ง 1. Open the x64 Developer Command Prompt

Search and launch:

x64 Native Tools Command Prompt for VS 2022

๐Ÿ“‚ 2. Clone this repository

git clone https://github.com/ivosetyadi/gnutime.git
cd gnutime

๐Ÿ›  3. Compile using cl.exe:

cl /O2 /Fe:gtime.exe gtime.c

This will produce gtime.exe โ€” a standalone, portable binary.


โ–ถ๏ธ Usage Examples

gtime ping 127.0.0.1 -n 3
gtime -f "elapsed=%e user=%U sys=%S" ping 127.0.0.1 -n 2
gtime -o time_result.txt -f "real=%e" myscript.bat

๐Ÿ“„ Format Codes (Partial Support)

Code Meaning
%e Elapsed real time (wall clock)
%U User CPU time
%S System CPU time
%% Literal %

Note: Memory/I/O stats like -v are not yet supported. Coming soon.


โ—Limitations

  • No -v or memory usage support (yet)
  • No support for complex nested shell commands (e.g., pipes or sh -c)
  • Only available on Windows (compiled for 64-bit targets)

๐Ÿ“Œ License

This implementation is provided under the MIT License.
It is not a direct fork of GNU time, but inspired by its functionality.

About

Windows-native port of GNU time (64-bit, no WSL/MSYS2/Cygwin).

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages