From 4815c32fef68530b0950b8c9c86fef2f712da05b Mon Sep 17 00:00:00 2001 From: haithium <128622475+haithium@users.noreply.github.com> Date: Sun, 28 Jun 2026 02:54:22 +0000 Subject: [PATCH] docs: generate docs for timeutil --- docs/src/timeutil/index.md | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/docs/src/timeutil/index.md b/docs/src/timeutil/index.md index a69ab16..fc08b49 100644 --- a/docs/src/timeutil/index.md +++ b/docs/src/timeutil/index.md @@ -1,22 +1,26 @@ # timeutil +[![Test](https://img.shields.io/github/actions/workflow/status/BlueLua/timeutil/test.yml?branch=main&label=test&style=flat-square)](https://github.com/BlueLua/timeutil/actions/workflows/test.yml) [![LuaRocks](https://img.shields.io/luarocks/v/BlueLua/timeutil?color=blue&style=flat-square)](https://luarocks.org/modules/BlueLua/timeutil) ![Lua Versions](https://img.shields.io/badge/lua-5.1%20%7C%205.2%20%7C%205.3%20%7C%205.4%20%7C%205.5%20%7C%20LuaJIT-blue?style=flat-square) ![Platform](https://img.shields.io/badge/platform-linux%20%7C%20macos%20%7C%20windows-blue?style=flat-square) [![License](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](https://github.com/BlueLua/timeutil/blob/main/LICENSE) -`timeutil` is a high-performance C-backed Lua module providing precision -wall-clock time, monotonic time, and sleep utilities. +High-performance C-backed Lua module for precision wall-clock time, monotonic +time, and sleep utilities. + +Check out the [documentation] for guides and examples. ## ✨ Features -- **Monotonic Clock**: Measure precise intervals unaffected by [NTP] syncs or - system clock shifts. +- **Monotonic Clock**: Measure precise intervals unaffected by system clock + shifts or NTP syncs. - **Wall-Clock Time**: Fetch system real-time with sub-microsecond precision. -- **Fractional Sleep**: Put the execution thread to sleep for fractional seconds - without high CPU utilization.a +- **Fractional Sleep**: Sleep for fractional seconds without busy-waiting or + high CPU utilization. - **Multiple Lua Versions**: Compatible with LuaJIT, Lua 5.1, 5.2, 5.3, 5.4, and 5.5. +- **Cross-Platform**: Works consistently across Windows, macOS, and Linux. ## 📦 Installation @@ -27,15 +31,15 @@ luarocks install timeutil ## 🚀 Usage ```lua -local time = require "timeutil" +local timeutil = require "timeutil" -- Measure precise elapsed time -local start = time.mono() -time.sleep(0.05) -- sleep for 50ms -local elapsed = time.mono() - start +local start = timeutil.mono() +timeutil.sleep(0.05) -- sleep for 50ms +local elapsed = timeutil.mono() - start -print(string.format("Elapsed: %.6f seconds", elapsed)) -print(string.format("Current Unix timestamp: %.6f", time.now())) +print(string.format("Elapsed:%.6f seconds", elapsed)) +print(string.format("Current Unix timestamp: %.6f", timeutil.now())) ``` -[NTP]: https://en.wikipedia.org/wiki/Network_Time_Protocol +[documentation]: https://bluelua.github.io/timeutil