Tcl\_GetTime(3) Tcl Library Procedures Tcl\_GetTime(3)

```

```

# [NAME](#NAME)

Tcl\_GetMonotonicTime, Tcl\_GetTime, Tcl\_SetTimeProc, Tcl\_QueryTimeProc - get date and time

# [SYNOPSIS](#SYNOPSIS)

```
#include <tcl.h>

long long
Tcl_GetMonotonicTime()

Tcl_GetTime(timePtr)

Tcl_SetTimeProc(getProc, scaleProc, clientData)

Tcl_QueryTimeProc(getProcPtr, scaleProcPtr, clientDataPtr)
```

# [ARGUMENTS](#ARGUMENTS)

Tcl\_Time *\*timePtr* (out)

Points to memory in which to store the date and time information.

Tcl\_GetTimeProc *getProc* (in)

Pointer to handler function replacing **Tcl\_GetTime**'s access to the OS.

Tcl\_ScaleTimeProc *scaleProc* (in)

Pointer to handler function for the conversion of time delays in the virtual domain to real-time.

void *\*clientData* (in)

Value passed through to the two handler functions.

Tcl\_GetTimeProc *\*getProcPtr* (out)

Pointer to place the currently registered get handler function into.

Tcl\_ScaleTimeProc *\*scaleProcPtr* (out)

Pointer to place the currently registered scale handler function into.

void *\*\*clientDataPtr* (out)

Pointer to place the currently registered pass-through value into.

```
    
```

# [DESCRIPTION](#DESCRIPTION)

The **Tcl\_GetMonotonicTime** function returns the current monotonic time. The unit is micro-seconds. Only time differences are defined. The timer value 0 may be the epoc but may also be the start-up of the system.

The value is contiguous but may jump due to timer virtualization or sleep mode.

The precision is system dependent and not guaranteed to be micro-second precise.

The **Tcl\_GetTime** function retrieves the current time as a *Tcl\_Time* structure in memory the caller provides. This structure has the following definition:

```
typedef struct {


    long long sec;


    long usec;
} Tcl_Time;
```

On return, the *sec* member of the structure is filled in with the number of seconds that have elapsed since the *epoch:* the epoch is the point in time of 00:00 UTC, 1 January 1970. This number does *not* count leap seconds; an interval of one day advances it by 86400 seconds regardless of whether a leap second has been inserted.

The *usec* member of the structure is filled in with the number of microseconds that have elapsed since the start of the second designated by *sec*.

This command uses the system wall clock and is not contiguous by definition. It may have large jumps in short time, specially if the system is awaked from sleep mode.

## [VIRTUALIZED TIME](#VIRTUALIZED_TIME)

The **Tcl\_SetTimeProc** and **Tcl\_QueryTimeProc** are not supported since TCL 9.1. They call a **Tcl\_Panic**.

# [SEE ALSO](#SEE_ALSO)

[clock(n)](/man/os/tcl/clock.n), [timer(n)](/man/os/tcl/timer.n)

# [KEYWORDS](#KEYWORDS)

date, time

8.4 Tcl

---

Document: Tcl_QueryTimeProc(3) from tcl 9.1.0-r0 (Chainguard OS)
Source: https://downloads.sourceforge.net/project/tcl/Tcl/9.1.0/tcl9.1.0-src.tar.gz
