@script::getTimeAsLong

Retrieves the date and time in epoch time (number of milliseconds since January 1, 1970).

Syntax:

@script::getTimeAsLong()

Parameters:

None

Returns:

(long) number of milliseconds since January 1, 1970, 00:00:00 GMT

Example:

The following code and comments illustrate how to find out how much time was remaining on a timeout setting when an event was terminated( based on the default script package):

# Get the initial timestamp
$initialTime = @script::getTimeAsLong()
 
# Begin timeout
UNTIL ( $main.continue, $main.timeout )
 
# Post UNTIL TimeStamp
$finalTime = @script::getTimeAsLong()
 
# Determine duration
$totalTime = $finalTime - $initialTime
 
# Convert totalTime to seconds
$totalTime = $totalTime / 1000
 
# Subtract duration from timeout value
$timeRemaining = $main.timeout - $totalTime
 
# Log the duration information
@script::log( $event.incident_id & ": Total duration of delay: " & $totalTime )
@script::log( $event.incident_id & ": Time remaining on timeout: " & $timeRemaining )