Documentation

# `rtime`

Measure real time

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```rtime()
rtime(`a1, a2, …`)
```

## Description

`rtime()` returns the real time that elapsed since the start of the current MuPAD® session. It is measured in milliseconds.

`rtime(a1, a2, ...)` returns the real time needed to evaluate all arguments.

The result of `rtime` is the real time. Thus, `rtime` can be used to measure the total time spent by the MuPAD process as well as by external processes spawned from inside the MuPAD session. Note that an interactive call of `rtime()` is not very useful because the idle time is included. However, ```rtime(a1, a2, ...)``` often yields a useful and more realistic timing than `time(a1, a2, ...)` if the evaluation of the arguments spawns external processes. For example, it can be useful for measuring time for numerical computations because some routines of the `numeric` library call external numerical tools using hardware floats.

If there are no running external processes besides MuPAD, the timings returned by `rtime(a1, a2, ...)` and ```time(a1, a2, ...)``` roughly coincide.

On computers without “time-sharing”, such as the Macintosh computer, real time and CPU time roughly coincide.

`rtime` is a function of the system kernel.

## Examples

### Example 1

Use `rtime` to compute the elapsed hours, minutes and seconds since this session was started:

```t := rtime()/1000: h := trunc(t/3600): m := trunc(t/60 - h*60): s := trunc(t - m*60 - h*3600):```
```print(Unquoted, "This session is running for " . h . " hours, " . m . " minutes and " . s . " seconds.")```
```This session is running for 0 hours, 0 minutes and 10 seconds. ```
`delete t, h, m, s:`

## Parameters

 `a1, a2, …` Arbitrary MuPAD objects

## Return Values

Nonnegative integer giving the elapsed time in milliseconds.