Tcl_GetTime(3)
π
Tcl_GetTime(3) β get date and time β¨
okay so this is the Tcl Library Procedures page for Tcl_GetTime(3) and its time-obsessed besties π«Ά. Buckle up, because weβre doing clocks, monotonic time, wall-clock chaos, and one very deprecated situation. No cap. π°οΈπ
πΈ 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 π
Tcl_Time *timePtr(out) β points to memory where the date and time info gets stored ποΈTcl_GetTimeProc getProc(in) β pointer to a handler function that replacesTcl_GetTimeβs access to the OS πTcl_ScaleTimeProc scaleProc(in) β pointer to a handler function for converting time delays from the virtual domain into real-time β³void *clientData(in) β a value passed through to the two handler functions πTcl_GetTimeProc *getProcPtr(out) β pointer to the place where the currently registered get handler function goes π₯Tcl_ScaleTimeProc *scaleProcPtr(out) β pointer to the place where the currently registered scale handler function goes π₯void **clientDataPtr(out) β pointer to the place where the currently registered pass-through value goes π₯
π¦ DESCRIPTION π¦
okay so Tcl_GetMonotonicTime returns the current monotonic time, bestie. 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. Itβs giving βclose enough, donβt @ me.β π
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 π
Tcl_SetTimeProc and Tcl_QueryTimeProc are not supported since TCL 9.1. They call a Tcl_Panic. So yeahβ¦ do not expect a cute little virtual-time moment from these two. Periodt. π¨π
π SEE ALSO π
β KEYWORDS β
datetime
xoxo, your Tcl 8.4 bestie π β footer tea: source/version is Tcl 8.4, page Tcl_GetTime(3), and the date is not printed on this footer, so thatβs the whole story π«Άπ
π¦ where this page comes from
- nixpkgs unstable: tcl 9.1.0
- Copyright (c) 2001 Kevin B. Kenny <kennykb@acm.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms