---@meta posix.time

---@class posix_tm*
---@field sec integer
---@field min integer
---@field hour integer
---@field mday integer
---@field mon integer
---@field year integer
---@field wday integer
---@field yday integer
---@field isdst integer

---@class posix_timespec*
---@field tv_sec integer
---@field tv_nsec integer

---@class posix_time*
---@field version string
---@field CLOCK_MONOTONIC integer
---@field CLOCK_PROCESS_CPUTIME_ID integer
---@field CLOCK_REALTIME integer
---@field CLOCK_THREAD_CPUTIME_ID integer
---@type posix_time*
local M = {}

---@param clockid integer
---@return posix_timespec*? res
---@return string? errMsg
---@return integer? errno
function M.clock_getres(clockid) end

---@param clockid integer
---@return posix_timespec*? time
---@return string? errMsg
---@return integer? errno
function M.clock_gettime(clockid) end

---@param time? integer
---@return posix_tm* tm
function M.gmtime(time) end

---@param time? integer
---@return posix_tm* tm
function M.localtime(time) end

---@param tm posix_tm*
---@return integer? time
---@return string? errMsg
---@return integer? errno
function M.mktime(tm) end

---@param seconds number|posix_timespec*
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.nanosleep(seconds) end

---@param format string
---@param tm? posix_tm*
---@return string formatted
function M.strftime(format, tm) end

---@param s string
---@param format string
---@return posix_tm? tm
function M.strptime(s, format) end

---@return integer time
function M.time() end

return M
