---
title: "now | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Function now

-   now(): number[](#now)
    
    Returns the current time in milliseconds. When time is frozen via setNow(), returns the frozen timestamp. Otherwise returns real browser time via performance.now().
    
    #### Returns number
    
    Current time in milliseconds
    
    #### Example[](#example)
    
    ```typescript
    // Measure elapsed time
    const start = maplibregl.now();
    // ... later ...
    const elapsed = maplibregl.now() - start;
    
    // During frozen time
    maplibregl.setNow(16.67);
    console.log(maplibregl.now()); // 16.67
    maplibregl.restoreNow();
    console.log(maplibregl.now()); // real time
    ```
