2 '\" Copyright (c
) 1992-1995 Karl Lehenbauer
and Mark Diekhans
.
3 '\" Copyright (c) 1995-1997 Sun Microsystems, Inc.
4 '\" Copyright (c
) 1998-1999 Scriptics Corporation
6 '\" This documentation is derived from the time
and date facilities of
7 '\" TclX, by Mark Diekhans and Karl Lehenbauer.
9 '\" See the file "license.terms" for information on usage and redistribution
10 '\" of
this file
, and for a DISCLAIMER OF ALL WARRANTIES
.
12 '\" RCS
: @
(#) $Id: clock.n,v 1.1 2003/12/20 03:31:54 bbbush Exp $
14 '\" The definitions below are
for supplemental macros used
in Tcl
/Tk
17 '\" .AP type name in/out ?indent?
18 '\" Start paragraph describing an argument to a library procedure
.
19 '\" type is type of argument (int, etc.), in/out is either "in", "out",
20 '\" or
"in/out" to describe whether procedure reads or modifies arg
,
21 '\" and indent is equivalent to second arg of .IP (shouldn't ever be
22 '\" needed; use .AS below instead)
25 '\" Give maximum sizes of arguments
for setting tab stops
. Type
and
26 '\" name are examples of largest possible arguments that will be passed
27 '\" to
.AP later
. If args are omitted
, default tab stops are used
.
30 '\" Start box enclosure. From here until next .BE, everything will be
31 '\" enclosed
in one large box
.
34 '\" End of box enclosure.
37 '\" Begin code excerpt
.
42 '\" .VS ?version? ?br?
43 '\" Begin vertical sidebar
, for use
in marking newly
-changed parts
44 '\" of man pages. The first argument is ignored and used for recording
45 '\" the version
when the
.VS was added
, so that the sidebars can be
46 '\" found and removed when they reach a certain age. If another argument
47 '\" is present
, then a line break is forced before starting the sidebar
.
50 '\" End of vertical sidebar.
53 '\" Begin an indented unfilled display
.
56 '\" End of indented unfilled display.
59 '\" Start of
list of standard options
for a Tk widget
. The
60 '\" options follow on successive lines, in four columns separated
64 '\" End of list of standard options for a Tk widget.
66 '\" .OP cmdName dbName dbClass
67 '\" Start of description of a specific option
. cmdName gives the
68 '\" option's name
as specified
in the
class command
, dbName gives
69 '\" the option's name
in the option database
, and dbClass gives
70 '\" the option's
class in the option database
.
73 '\" Print arg1 underlined, then print arg2 normally.
75 '\" RCS: @(#) $Id: clock.n,v 1.1 2003/12/20 03:31:54 bbbush Exp $
77 '\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
81 '\" # Start an argument description
85 . ie !"\\$2
"" .TP
\\n()Cu
90 \&\\$1 \\fI\\$2\\fP (\\$3)
103 '\" # define tabbing values for .AP
106 .if !"\\$1"" .nr )A \\w'\\$1
'u+3n
109 .if !"\\$2"" .nr )B \\w'\\$2
'u+\\n()Au+3n
110 .nr )C \\n()Bu+\\w'(in/out)'u+2n
112 .AS Tcl_Interp Tcl_CreateInterp in/out
113 '\" # BS - start boxed text
114 '\" # ^y = starting y location
122 .if n \l
'\\n(.lu\(ul'
125 '\" # BE - end boxed text (draw box now)
130 .ie n \l'\\n(^lu\
(ul
'
132 .\" Draw four-sided box normally, but don't draw top of
133 .\" box
if the box started on an earlier page
.
135 \h
'-1.5n'\L
'|\\n(^yu-1v'\l
'\\n(^lu+3n\(ul'\L
'\\n(^tu+1v-\\n(^yu'\l
'|0u-1.5n\(ul'
138 \h
'-1.5n'\L
'|\\n(^yu-1v'\h
'\\n(^lu+3n'\L
'\\n(^tu+1v-\\n(^yu'\l
'|0u-1.5n\(ul'
145 '\" # VS - start vertical sidebar
146 '\" # ^Y = starting y location
147 '\" # ^v = 1 (for troff; for nroff this doesn't matter
)
151 .ie n 'mc \s12\(br\s0
154 '\" # VE - end of vertical sidebar
162 \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
169 '\" # Special macro to handle page bottom: finish off current
170 '\" # box/sidebar if in box/sidebar mode, then invoked standard
171 '\" # page bottom macro.
178 .\" Draw three-sided box if this is the box's first page,
179 .\" draw two sides but no top otherwise.
180 .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
181 .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
184 .nr ^x \\n(^tu+1v-\\n(^Yu
185 \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
198 '\" # DS - begin display
204 '\" # DE - end display
210 '\" # SO - start of list of standard options
212 .SH "STANDARD OPTIONS
"
218 '\" # SE - end of list of standard options
223 See the \\fBoptions\\fR manual entry for details on the standard options.
225 '\" # OP - start of full description for a single option
230 Command-Line Name: \\fB\\$1\\fR
231 Database Name: \\fB\\$2\\fR
232 Database Class: \\fB\\$3\\fR
236 '\" # CS - begin code excerpt
242 '\" # CE - end code excerpt
250 .TH clock n 8.3 Tcl "Tcl Built
-In Commands
"
252 '\" Note: do not modify the .SH NAME line immediately below!
254 clock \- Obtain and manipulate time
256 \fBclock \fIoption\fR ?\fIarg arg ...\fR?
261 This command performs one of several operations that may obtain
262 or manipulate strings or values that represent some notion of
263 time. The \fIoption\fR argument determines what action is carried
264 out by the command. The legal \fIoptions\fR (which may be
268 \fBclock clicks\fR ?\fB\-milliseconds\fR?
269 Return a high-resolution time value as a system-dependent integer
270 value. The unit of the value is system-dependent but should be the
271 highest resolution clock available on the system such as a CPU cycle
272 counter. If \fB\-milliseconds\fR is specified, then the value is
273 guaranteed to be of millisecond granularity.
274 This value should only be used for the relative measurement
278 \fBclock format \fIclockValue\fR ?\fB\-format \fIstring\fR? ?\fB\-gmt \fIboolean\fR?
279 Converts an integer time value, typically returned by
280 \fBclock seconds\fR, \fBclock scan\fR, or the \fBatime\fR, \fBmtime\fR,
281 or \fBctime\fR options of the \fBfile\fR command, to human-readable
282 form. If the \fB\-format\fR argument is present the next argument is a
283 string that describes how the date and time are to be formatted.
284 Field descriptors consist of a \fB%\fR followed by a field
285 descriptor character. All other characters are copied into the result.
286 Valid field descriptors are:
291 Abbreviated weekday name (Mon, Tue, etc.).
293 Full weekday name (Monday, Tuesday, etc.).
295 Abbreviated month name (Jan, Feb, etc.).
299 Locale specific date and time.
301 Day of month (01 - 31).
303 Hour in 24-hour format (00 - 23).
305 Hour in 12-hour format (00 - 12).
307 Day of year (001 - 366).
309 Month number (01 - 12).
317 Week of year (00 - 52), Sunday is the first day of the week.
319 Weekday number (Sunday = 0).
321 Week of year (00 - 52), Monday is the first day of the week.
323 Locale specific date format.
325 Locale specific time format.
327 Year without century (00 - 99).
329 Year with century (e.g. 1990)
335 In addition, the following field descriptors may be supported on some
336 systems (e.g. Unix but not Windows):
340 Day of month (1 - 31), no leading zeros.
342 Abbreviated month name.
356 If the \fB\-format\fR argument is not specified, the format string
357 "\fB%a %b %d %H
:%M
:%S %Z %Y
\fR
" is used. If the \fB\-gmt\fR argument
358 is present the next argument must be a boolean which if true specifies
359 that the time will be formatted as Greenwich Mean Time. If false
360 then the local timezone will be used as defined by the operating
364 \fBclock scan \fIdateString\fR ?\fB\-base \fIclockVal\fR? ?\fB\-gmt \fIboolean\fR?
365 Convert \fIdateString\fR to an integer clock value (see \fBclock seconds\fR).
366 This command can parse and convert virtually any standard date and/or time
367 string, which can include standard time zone mnemonics. If only a time is
368 specified, the current date is assumed. If the string does not contain a
369 time zone mnemonic, the local time zone is assumed, unless the \fB\-gmt\fR
370 argument is true, in which case the clock value is calculated assuming
371 that the specified time is relative to Greenwich Mean Time.
372 \fB-gmt\fR, if specified, affects only the computed time value; it does not
373 impact the interpretation of \fB-base\fR.
375 If the \fB\-base\fR flag is specified, the next argument should contain
376 an integer clock value. Only the date in this value is used, not the
377 time. This is useful for determining the time on a specific day or
378 doing other date-relative conversions.
380 The \fIdateString\fR consists of zero or more specifications of the
385 A time of day, which is of the form: \fIhh\fR?\fI:mm\fR?\fI:ss\fR??
386 ?\fImeridian\fR? ?\fIzone\fR? or \fIhhmm \fR?\fImeridian\fR?
387 ?\fIzone\fR?. If no meridian is specified, \fIhh\fR is interpreted on
391 A specific month and day with optional year. The
392 acceptable formats are \fImm/dd\fR?\fI/yy\fR?, \fImonthname dd\fR
393 ?, \fIyy\fR?, \fIdd monthname \fR?\fIyy\fR?, \fIday, dd monthname
394 yy\fR, \fI?CC?yymmdd\fR, \fI?CC?yy-mm-dd\fR, \fIdd-monthname-?CC?yy\fR.
395 The default year is the current year. If the year is less
397 than 100, we treat the years 00-68 as 2000-2068 and the years 69-99
398 as 1969-1999. Not all platforms can represent the years 38-70, so
399 an error may result if these years are used.
402 \fIISO 8601 point-in-time\fR
403 An ISO 8601 point-in-time specification, such as \fICCyymmddThhmmss\fR, where
404 T is the literal T, \fICCyymmdd hhmmss\fR, or
405 \fICCyymmddThh:mm:ss\fR.
408 A specification relative to the current time. The format is \fInumber
409 unit\fR acceptable units are \fByear\fR, \fBfortnight\fR, \fBmonth\fR, \fBweek\fR, \fBday\fR,
410 \fBhour\fR, \fBminute\fR (or \fBmin\fR), and \fBsecond\fR (or \fBsec\fR). The
411 unit can be specified as a singular or plural, as in \fB3 weeks\fR.
412 These modifiers may also be specified:
413 \fBtomorrow\fR, \fByesterday\fR, \fBtoday\fR, \fBnow\fR,
414 \fBlast\fR, \fBthis\fR, \fBnext\fR, \fBago\fR.
418 The actual date is calculated according to the following steps.
419 First, any absolute date and/or time is processed and converted.
420 Using that time as the base, day-of-week specifications are added.
421 Next, relative specifications are used. If a date or day is
422 specified, and no absolute or relative time is given, midnight is
423 used. Finally, a correction is applied so that the correct hour of
424 the day is produced after allowing for daylight savings time
425 differences and the correct date is given when going from the end
426 of a long month to a short month.
428 Daylight savings time correction is applied only when the relative time
429 is specified in units of days or more, ie, days, weeks, fortnights, months or
430 years. This means that when crossing the daylight savings time boundary,
431 different results will be given for \fBclock scan "1 day
"\fR and
432 \fBclock scan "24 hours
"\fR:
435 \fB% clock scan "1 day
" -base [clock scan 1999-10-31]
437 % clock scan "24 hours
" -base [clock scan 1999-10-31]
443 Return the current date and time as a system-dependent integer value. The
444 unit of the value is seconds, allowing it to be used for relative time
445 calculations. The value is usually defined as total elapsed time from
446 an ``epoch''. You shouldn't assume the value of the epoch.