Tcl_GetTime(3)

NAME
Tcl_GetMonotonicTime, Tcl_GetTime, Tcl_SetTimeProc, Tcl_QueryTimeProc - get date and time

SYNOPSIS
#include <tcl.h>

long long
Tcl_GetMonotonicTime()

Tcl_GetTime(timePtr)

Tcl_SetTimeProc(getProc, scaleProc, clientData)

Tcl_QueryTimeProc(getProcPtr, scaleProcPtr, clientDataPtr)

ARGUMENTS
Points to memory in which to store the date and time information. Pointer to handler function replacing Tcl_GetTime's access to the OS. Pointer to handler function for the conversion of time delays in the virtual domain to real-time. Value passed through to the two handler functions. Pointer to place the currently registered get handler function into. Pointer to place the currently registered scale handler function into. Pointer to place the currently registered pass-through value into.

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

The Tcl_SetTimeProc and Tcl_QueryTimeProc are not supported since TCL 9.1. They call a Tcl_Panic.

SEE ALSO
clock(n), timer(n)

KEYWORDS
date, time