> For the complete documentation index, see [llms.txt](https://vrs-book-complete.gitbook.io/virtual-robot-simulator-official-guidebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vrs-book-complete.gitbook.io/virtual-robot-simulator-official-guidebook/programming/blocks/utilities/time.md).

# Time

Time plays a critical role in various aspects of robot design, programming, and competition strategy. The blocks in this section allow you to get high precision system time and calculate the elapsed time.

**nanoTime**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdw24OeEjFhMVYiiLCLXzTyEThKvXMgkeSXjqliXzDNlnMfzPSDnvnKlCjxC5-MPj7wMCxgCVltNsH-XVb84L8M8_UTyGVrcvRUuVcCb-eCbkVPih0yrfIQuiJYP6vj-HXPjqDxU4w2CooFHzfYQLPtyoIo?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Return the current system time in nanoseconds.

**ElapsedTime**

Elapsed time simply refers to the amount of time that has passed between a starting point and an ending point. It's the duration of an event or the time it takes for something to happen.

**new ElapsedTime**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdSAo_jqJbfDNRzoxdIqn0JpEF9DRaJJqRqKYx5BgmZCHvCNl26cx53GQ4S_-0gA6D4NwReEIxjWVP1I8Mv7O16barRoyum-YioJtYIQ2Ttmz10Aqt3oMdaR6oDDx5q84F-jpProBoBY4kxVTG4AeFLA-l9?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Returns an ElapsedTime object presenting a timer with SECONDS resolution, initialized with the current system time.

**new ElapsedTime (startTime)**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXcF9Xug4EQN9vcb5xxX5I5kXzNzjKD_m5HS4bNV2csJaNJ2Voo4TxFIhgi2kDSVUvfWjac6yS-_jHYLP19sNKGBu8cxCYJ35y8-wdeRQAtfZhMzxiAavwzEEviVIeCi1xuqko0j_60ywJKjRlr0fXzmmVWB?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Returns an ElapsedTime object presenting a timer with SECONDS resolution, initialized with a given start time.

**new ElapsedTime (resolution)**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXfQl7-HN61tgs_O3N7nh2Ny9QeqwqwyfCHrUwmCPxJJZn6xFcENGYSCu6zK5lwpvbXXEf3x3j-14K4cY2ojdJ7DvfQOsfZykdMt1RQcAic-PLVdfj2J_NUcVMtwGt9GkHKRcD5mQ1ThkTw8ynlF4_EHgmc?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Create a new elapsed time object with a resolution of SECONDS or MILLISECONDS,  initialized with the current system time.

**StartTime**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXfNI2oBDkSmvB5Nn5N1OsMxo5X1ofdsyQEHUFEafBdARDvpJSw_fDEYAVFSQdPX-yl89CWc7KMQuxWEWp2026dZp-ABO03mkW4gmC3OKkzz0jIhrVhoCOj8QsmUvqVkkq-dUA0RpKlgQT9sJl4G_3Rq60nQ?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Returns the start time of the specified elapsed time object using the current resolution of the elapsed time object. Please note that the start time may be reset.

**Time**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXcJByJGwhcescpXwkJoHgPMFj-8J5SJqnby1P90IRFdhQouIyOjPP3KkUAM4AMb3pinjX6tCfwKlJHCeILRPrktP5I8VTQUqwsy7D1FXZIjoEijGeLwmA97I72EZmT9Zo2ORq5R_MkifRJfeJpS0cPFhBnv?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Returns the duration that has elapsed since the last reset of the timer. The duration is a float number measured with the elapsed time object’s resolution - either SECONDS or MILLISECONDS.

**Seconds**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXcTzJhVL-4gH1ENAhWjkIgtWW6RclIECSoKRyzWI8yLUmodicFRDmPW63nqLuYX0xep98N3IMUI3486W6_B2KuJANCdF58Ie-pkD0N7hV3RXQvx4QxmkcsSYRj5DmtPKRalZNDKRReexzEmZ0erIoB3DnA?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Returns the elapsed time in seconds since the last reset of the elapsed time object.

**Milliseconds**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXe6-cfU_Di9sid6vWWaESGoGefi2R27plRsYA0K0c9pIO6n2cseSMPgaoOoOiAK9CwS4qKv7Pn_6OxOCdKvnY7rtx1ua9o4uvBiEEEOOMUtOqOqvSjUjYFbHtpWotc64D5XZRC6h5D8I7i62D2NAXKYvGuJ?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Returns the elapsed time in milliseconds since the last reset of the elapsed time object.

**Resolution**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeyPi8s1s5jJ5cMgl--xMsBlm3tQV6U0Npa3PFC_Kf4LPik1_vp3i1fz2kDLYf-trYwpwi7wdGQkFpOEd6TBzjJppHswA5MF4qekEclD10od537LdvJPewHdQoNRT8Mcr7s5OyoegF2ydjt12qTcg3TFyI?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Returns the current resolution of the elapsed time object – either SECONDS or MILLISECONDS.

**reset**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdWA1CSfmB_Y1d0EAa4P9jG-yopCK_eTGs_R3YNAVsftfvR1uQ6WS9335OGal0V1SermsWyE9geK0l4Mt-Bnny9pMCq5kNKAoL9_XQkNGEg_YSMHYm5ZoX-x4WnIv6M6U_FaTCRmEAvjuSstz73aubAC4lX?key=hRw9bBhBfp1lHBJ7rUAI2Q)

&#x20;Resets the specified elapsed time object. After reset, the start time is set to the current system time.

**toText**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeCBZg11bf32n1bFQtqc2QTLjuJtstq7a0Oy66W8L99z9-RlKJ3nUzYIQF9vaLiCSPru7i4fqUJUHJW8PPhrKVYl8ayXhdQY3HqoNhDgFxWeCuc1evtsWNmrGlBxBIZimVkCrdDrJaMUtqlF_k5c5mVbY1J?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Returns a text string giving the elapsed time of the elapsed time object. For example, “10.2500 milliseconds.”
