-
Notifications
You must be signed in to change notification settings - Fork 621
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: documentation for NASL ISO time functions
- Loading branch information
Showing
6 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
doc/manual/nasl/built-in-functions/isotime-functions/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
33 changes: 33 additions & 0 deletions
33
doc/manual/nasl/built-in-functions/isotime-functions/isotime_add.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
21 changes: 21 additions & 0 deletions
21
doc/manual/nasl/built-in-functions/isotime-functions/isotime_is_valid.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
17 changes: 17 additions & 0 deletions
17
doc/manual/nasl/built-in-functions/isotime-functions/isotime_now.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
23 changes: 23 additions & 0 deletions
23
doc/manual/nasl/built-in-functions/isotime-functions/isotime_print.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
27 changes: 27 additions & 0 deletions
27
doc/manual/nasl/built-in-functions/isotime-functions/isotime_scan.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |