diff --git a/doc/manual/nasl/built-in-functions/isotime-functions/index.md b/doc/manual/nasl/built-in-functions/isotime-functions/index.md new file mode 100644 index 000000000..6df58c7bb --- /dev/null +++ b/doc/manual/nasl/built-in-functions/isotime-functions/index.md @@ -0,0 +1,9 @@ +# ISO time functions + +## GENERAL + +The ISO time is standardized form for representing time formats from the year 0 to 9999. This family of functions are able to generate and alter given times in such formats, as well as get information about the current time. + +In most 32 bit systems a signed 32 bit integer value is used to represent the system time. Unfortunately this only enables the usage of time between 1. January 1970 00:00:00 to 19. January 2038 03:14:07. However for VTs we sometimes need to calculate dates in the future beyond that. For example some certificates are (for whatever reason) valid for 30 years. To solve this problem in a platform independent way, we provide the time as a string and provide functions to work with them. + +## TOC diff --git a/doc/manual/nasl/built-in-functions/isotime-functions/isotime_add.md b/doc/manual/nasl/built-in-functions/isotime-functions/isotime_add.md new file mode 100644 index 000000000..b46426e44 --- /dev/null +++ b/doc/manual/nasl/built-in-functions/isotime-functions/isotime_add.md @@ -0,0 +1,33 @@ +# isotime_add + +## NAME + +**isotime_add** - add years, days or seconds to an ISO time string + +## SYNOPSIS + +*string* **isotime_add**(0: *string*, years: *int*, days: *int*, seconds: *int*); + +**isotime_add** takes 1 positional and up to 3 named arguments. + +## DESCRIPTION + +Adds given years, days and seconds to a given ISO time string. + +The first positional argument is a *string* containing an ISO time string. + +The named argument *years* is an *int* containing the number of years to add to the ISO time string + +The named argument *days* is an *int* containing the number of days to add to the ISO time string + +The named argument *seconds* is an *int* containing the number of seconds to add to the ISO time string + +## RETURN VALUE + +The resulting ISO time as *string* or *NULL* on error + +## ERRORS + +The first positional argument containing the ISO time string is missing or invalid. + +The result would overflow, i.e. year >9999. diff --git a/doc/manual/nasl/built-in-functions/isotime-functions/isotime_is_valid.md b/doc/manual/nasl/built-in-functions/isotime-functions/isotime_is_valid.md new file mode 100644 index 000000000..87590c3eb --- /dev/null +++ b/doc/manual/nasl/built-in-functions/isotime-functions/isotime_is_valid.md @@ -0,0 +1,21 @@ +# isotime_is_valid + +## NAME + +**isotime_is_valid** - check if a ISO time string is valid + +## SYNOPSIS + +*bool* **isotime_is_valid**(0: *string*); + +**isotime_is_valid** takes 1 positional argument. + +## DESCRIPTION + +Checks the validity for a given ISO time string. Valid strings are both the standard 15 byte string (`yyyymmddThhmmss`) and the better human readable up to 19 byte (`yyyy-mm-dd[ hh[:mm[:ss]]]`) are valid. + +The first unnamed argument is the *string* to be checked. + +## RETURN VALUE + +A *bool* either TRUE or FALSE diff --git a/doc/manual/nasl/built-in-functions/isotime-functions/isotime_now.md b/doc/manual/nasl/built-in-functions/isotime-functions/isotime_now.md new file mode 100644 index 000000000..ce2ec7b6f --- /dev/null +++ b/doc/manual/nasl/built-in-functions/isotime-functions/isotime_now.md @@ -0,0 +1,17 @@ +# isotime_now + +## NAME + +**isotime_now** - get the current time in the standard ISO format + +*string* **isotime_now**(); + +**isotime_now** takes no arguments + +## DESCRIPTION + +If available get the current time in the standard ISO time format (`yyyymmddThhmmss`). + +## RETURN VALUE + +The current ISO time as *string* or *NULL* if no time is available. diff --git a/doc/manual/nasl/built-in-functions/isotime-functions/isotime_print.md b/doc/manual/nasl/built-in-functions/isotime-functions/isotime_print.md new file mode 100644 index 000000000..e8366337c --- /dev/null +++ b/doc/manual/nasl/built-in-functions/isotime-functions/isotime_print.md @@ -0,0 +1,23 @@ +# isotime_print + +## NAME + +**isotime_print** - convert ISO time string to a better readable form + +*string* **isotime_print**(0: *string*); + +**isotime_print** takes one positional argument. + +## DESCRIPTION + +Convert a standard isotime (`yyyymmddThhmmss`) into the human readable variant (`yyyy-mm-dd hh:mm:ss`). + +The first unnamed argument is a *string* containing the string to convert. + +## RETURN VALUE + +The ISO time in a human readable form as *string* or *NULL* on error. + +## ERRORS + +First unnamed argument is either missing or in the wrong format. diff --git a/doc/manual/nasl/built-in-functions/isotime-functions/isotime_scan.md b/doc/manual/nasl/built-in-functions/isotime-functions/isotime_scan.md new file mode 100644 index 000000000..3a996d3c7 --- /dev/null +++ b/doc/manual/nasl/built-in-functions/isotime-functions/isotime_scan.md @@ -0,0 +1,27 @@ +# isotime_scan + +## NAME + +**isotime_scan** - convert a string into an ISO time string + +*string* **isotime_scan**(0: *string*); + +**isotime_scan** takes 1 positional argument. + +## DESCRIPTION + +Convert a standard isotime (`yyyymmddThhmmss`) or a human readable variant (`yyyy-mm-dd[ hh[:mm[:ss]]]`) into the standard isotime (`yyyymmddThhmmss`). + +The first unnamed argument is a *string* containing the string to convert. + +## RETURN VALUE + +The standard ISO time as *string* or *NULL* on error. + +## ERRORS + +First unnamed argument is missing. + +Given string is too short. + +Unable to convert string.