Tcl_GetTime(3)

πŸ“¦ version 9.1.0, in nixpkgs unstable

πŸ’… 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 replaces Tcl_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 ⭐

  • date
  • time

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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms