---
title: "getSystemTime"
canonical: "https://help.vicon.com/space/ShogunPost121/1253737695/getSystemTime"
format: markdown
---
# Description

Gets the system date and time in seconds, as an integer. Useful for determining execution time of a script or other length operations.

Passing the system time to [formatTime](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737213) provides a textual representation of the time, useful for time stamps or other places where date and time are needed.

## Functional area

System

# Command syntax

## Syntax

> Macro (scroll-tablelayout)

|  |
| --- |
| `getSystemTime` |

### Arguments

None

### Flags

None

## Return value

integer

Return the time as seconds elapsed since midnight, January 1, 1970 

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Calculate how long it takes to go through a 1,000,000
// iteration loop. It's about 3 seconds on a 3ghz machine.
int $i, $startTime, $endTime;
string $timeStr;
 
// Get the start time
$startTime = `getSystemTime`;
$timeStr = `formatTime $startTime`;
print $timeStr;
 
// Do an empty, lengthy loop
while( $i < 1000000 )
 {
   $i += 1;
 } 
// Get the end time
$endTime = `getSystemTime`;
$timeStr = `formatTime $endTime`;
print $timeStr;
 
// Now get the execution time
print int( $endTime - $startTime );
```

# Additional information

## Related commands

- [formatTime](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737213)
- [system](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737341)