# endTime

**Kind:** Function

**Source:** [`src/middleware/timing/timing.ts`](https://github.com/honojs/hono/blob/main/src/middleware/timing/timing.ts#L208)

**Part of:** [Middleware](subsystem-src-middleware)

End a timer for the timing middleware.

`endTime` stops the timer managed by the timing middleware when request processing finishes. It pairs with the middleware’s timer start logic to calculate and record timing data for the completed request.

## Signature

```ts
function endTime(c: Context, name: string, precision: number)
```

## Parameters

| Name | Type |
|---|---|
| `c` | `Context` |
| `name` | `string` |
| `precision` | `number` |

## Diagram

```mermaid
graph LR
  Request[Incoming request] --> Start[Start timing middleware]
  Start --> Handler[Request handler]
  Handler --> End[endTime]
  End --> Timing[Elapsed timing data]
  Timing --> Response[Completed response]
```

## Usage

```ts
import { endTime } from './middleware/timing/timing';

// Call after the request handler has completed and the timer state exists.
function onRequestComplete(request: Request, response: Response) {
  endTime(request, response);
}
```

## AI Coding Instructions

- Call `endTime` only after the timing middleware has initialized timer state for the request.
- Keep timer start and end handling within the same request lifecycle.
- Preserve any request or response fields used to store timing data.
- Invoke the function from response completion or middleware flow rather than before handler work has finished.
