diff --git a/doc/17-library-reference.md b/doc/17-library-reference.md index aca1c767e..f6e8e1917 100644 --- a/doc/17-library-reference.md +++ b/doc/17-library-reference.md @@ -17,6 +17,7 @@ random() | Returns a random value between 0 and RAND_MAX log(value) | Writes a message to the log. Non-string values are converted to a JSON string. log(severity, facility, value) | Writes a message to the log. `severity` can be one of `LogDebug`, `LogNotice`, `LogInformation`, `LogWarning`, and `LogCritical`. Non-string values are converted to a JSON string. typeof(value) | Returns the type object for a value. +get_time() | Returns the current UNIX timestamp. exit(integer) | Terminates the application. ## Object Accessor Functions diff --git a/lib/base/scriptutils.cpp b/lib/base/scriptutils.cpp index 762f34c6a..3b743169d 100644 --- a/lib/base/scriptutils.cpp +++ b/lib/base/scriptutils.cpp @@ -51,6 +51,7 @@ REGISTER_SCRIPTFUNCTION(assert, &ScriptUtils::Assert); REGISTER_SCRIPTFUNCTION(string, &ScriptUtils::CastString); REGISTER_SCRIPTFUNCTION(number, &ScriptUtils::CastNumber); REGISTER_SCRIPTFUNCTION(bool, &ScriptUtils::CastBool); +REGISTER_SCRIPTFUNCTION(get_time, &Utility::GetTime); String ScriptUtils::CastString(const Value& value) {