Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/doc/GetTime.3 @ 25

Last change on this file since 25 was 25, checked in by landauf, 17 years ago

added tcl to libs

File size: 4.1 KB
RevLine 
[25]1'\"
2'\" Copyright (c) 2001 by Kevin B. Kenny <kennykb@acm.org>.
3'\"
4'\" See the file "license.terms" for information on usage and redistribution
5'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6'\"
7'\" RCS: @(#) $Id$
8'\"
9.so man.macros
10.TH Tcl_GetTime 3 8.4 Tcl "Tcl Library Procedures"
11.BS
12.SH NAME
13Tcl_GetTime, Tcl_SetTimeProc, Tcl_QueryTimeProc \- get date and time
14.SH SYNOPSIS
15.nf
16\fB#include <tcl.h>\fR
17.sp
18\fBTcl_GetTime\fR(\fItimePtr\fR)
19.sp
20\fBTcl_SetTimeProc\fR(\fIgetProc, scaleProc, clientData\fR)
21.sp
22\fBTcl_QueryTimeProc\fR(\fIgetProcPtr, scaleProcPtr, clientDataPtr\fR)
23.SH ARGUMENTS
24.AS "Tcl_Time *" timePtr out
25.AP "Tcl_Time *" timePtr out
26Points to memory in which to store the date and time information.
27.AS "Tcl_GetTimeProc *" getProc in
28.AP "Tcl_GetTimeProc *" getProc in
29Pointer to handler function replacing \fBTcl_GetTime\fR's access to the OS.
30.AS "Tcl_ScaleTimeProc *" scaleProc in
31.AP "Tcl_ScaleTimeProc *" scaleProc in
32Pointer to handler function for the conversion of time delays in the
33virtual domain to real-time.
34.AS "ClientData *" clientData in
35.AP "ClientData *" clientData in
36Value passed through to the two handler functions.
37.AS "Tcl_GetTimeProc **" getProcPtr inout
38.AP "Tcl_GetTimeProc **" getProcPtr inout
39Pointer to place the currently registered get handler function into.
40.AS "Tcl_ScaleTimeProc **" scaleProcPtr inout
41.AP "Tcl_ScaleTimeProc **" scaleProcPtr inout
42Pointer to place the currently registered scale handler function into.
43.AS "ClientData **" clientDataPtr inout
44.AP "ClientData **" clientDataPtr inout
45Pointer to place the currently registered pass-through value into.
46.BE
47.SH DESCRIPTION
48.PP
49The \fBTcl_GetTime\fR function retrieves the current time as a
50\fITcl_Time\fR structure in memory the caller provides.  This
51structure has the following definition:
52.CS
53typedef struct Tcl_Time {
54    long sec;
55    long usec;
56} Tcl_Time;
57.CE
58.PP
59On return, the \fIsec\fR member of the structure is filled in with the
60number of seconds that have elapsed since the \fIepoch:\fR the epoch
61is the point in time of 00:00 UTC, 1 January 1970.  This number does
62\fInot\fR count leap seconds \- an interval of one day advances it by
6386400 seconds regardless of whether a leap second has been inserted.
64.PP
65The \fIusec\fR member of the structure is filled in with the number of
66microseconds that have elapsed since the start of the second
67designated by \fIsec\fR.  The Tcl library makes every effort to keep
68this number as precise as possible, subject to the limitations of the
69computer system.  On multiprocessor variants of Windows, this number
70may be limited to the 10- or 20-ms granularity of the system clock.
71(On single-processor Windows systems, the \fIusec\fR field is derived
72from a performance counter and is highly precise.)
73.PP
74The \fBTcl_SetTime\fR function registers two related handler functions
75with the core. The first handler function is a replacement for
76\fBTcl_GetTime\fR, or rather the OS access made by
77\fBTcl_GetTime\fR. The other handler function is used by the Tcl
78notifier to convert wait/block times from the virtual domain into real
79time.
80.PP
81The \fBTcl_QueryTime\fR function returns the currently registered
82handler functions. If no external handlers were set then this will
83return the standard handlers accessing and processing the native time
84of the OS. The arguments to the function are allowed to be NULL; and
85any argument which is NULL is ignored and not set.
86.PP
87Any handler pair specified has to return data which is consistent
88between them. In other words, setting one handler of the pair to
89something assuming a 10-times slowdown, and the other handler of the
90pair to something assuming a two-times slowdown is wrong and not
91allowed.
92.PP
93The set handler functions are allowed to run the delivered time
94backwards, however this should be avoided. We have to allow it as the
95native time can run backwards as the user can fiddle with the system
96time one way or other. Note that the insertion of the hooks will not
97change the behaviour of the Tcl core with regard to this situation,
98i.e. the existing behaviour is retained.
99.SH "SEE ALSO"
100clock
101.SH KEYWORDS
102date, time
Note: See TracBrowser for help on using the repository browser.