aboutsummaryrefslogtreecommitdiff
path: root/pandoc-lua-engine/src/Text/Pandoc/Lua/Module
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2023-02-14 17:23:23 +0100
committerJohn MacFarlane <[email protected]>2023-02-14 09:44:20 -0800
commit45367cdd37f34ee84bed4f024e33d2ec659fefd6 (patch)
tree830ea3095159fbdd5150be5987594a217e6832e8 /pandoc-lua-engine/src/Text/Pandoc/Lua/Module
parent351a8e6c7ce6ccd20eb62bd43f7f5cc9048c65d8 (diff)
Lua: add new function pandoc.system.cputime.
The function returns the CPU time consumed by pandoc and can be used to benchmark Lua computations.
Diffstat (limited to 'pandoc-lua-engine/src/Text/Pandoc/Lua/Module')
-rw-r--r--pandoc-lua-engine/src/Text/Pandoc/Lua/Module/System.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/System.hs b/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/System.hs
index 0f32bdaa8..61ab949a8 100644
--- a/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/System.hs
+++ b/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/System.hs
@@ -14,9 +14,11 @@ module Text.Pandoc.Lua.Module.System
( documentedModule
) where
+import Data.Version (makeVersion)
import HsLua
import HsLua.Module.System
- (arch, env, getwd, ls, mkdir, os, rmdir, with_env, with_tmpdir, with_wd)
+ ( arch, cputime, env, getwd, ls, mkdir, os, rmdir
+ , with_env, with_tmpdir, with_wd)
-- | Push the pandoc.system module on the Lua stack.
documentedModule :: LuaError e => Module e
@@ -28,7 +30,8 @@ documentedModule = Module
, os
]
, moduleFunctions =
- [ setName "environment" env
+ [ cputime `since` makeVersion [3, 1, 1]
+ , setName "environment" env
, setName "get_working_directory" getwd
, setName "list_directory" ls
, setName "make_directory" mkdir