Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / man / mann / clock.n
CommitLineData
920dae64
AT
1'\"
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
5'\" Copyright (c) 2002 ActiveState Corporation
6'\"
7'\" This documentation is derived from the time and date facilities of
8'\" TclX, by Mark Diekhans and Karl Lehenbauer.
9'\"
10'\" See the file "license.terms" for information on usage and redistribution
11'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12'\"
13'\" RCS: @(#) $Id: clock.n,v 1.11.2.6 2004/12/13 15:52:21 kennykb Exp $
14'\"
15'\" The definitions below are for supplemental macros used in Tcl/Tk
16'\" manual entries.
17'\"
18'\" .AP type name in/out ?indent?
19'\" Start paragraph describing an argument to a library procedure.
20'\" type is type of argument (int, etc.), in/out is either "in", "out",
21'\" or "in/out" to describe whether procedure reads or modifies arg,
22'\" and indent is equivalent to second arg of .IP (shouldn't ever be
23'\" needed; use .AS below instead)
24'\"
25'\" .AS ?type? ?name?
26'\" Give maximum sizes of arguments for setting tab stops. Type and
27'\" name are examples of largest possible arguments that will be passed
28'\" to .AP later. If args are omitted, default tab stops are used.
29'\"
30'\" .BS
31'\" Start box enclosure. From here until next .BE, everything will be
32'\" enclosed in one large box.
33'\"
34'\" .BE
35'\" End of box enclosure.
36'\"
37'\" .CS
38'\" Begin code excerpt.
39'\"
40'\" .CE
41'\" End code excerpt.
42'\"
43'\" .VS ?version? ?br?
44'\" Begin vertical sidebar, for use in marking newly-changed parts
45'\" of man pages. The first argument is ignored and used for recording
46'\" the version when the .VS was added, so that the sidebars can be
47'\" found and removed when they reach a certain age. If another argument
48'\" is present, then a line break is forced before starting the sidebar.
49'\"
50'\" .VE
51'\" End of vertical sidebar.
52'\"
53'\" .DS
54'\" Begin an indented unfilled display.
55'\"
56'\" .DE
57'\" End of indented unfilled display.
58'\"
59'\" .SO
60'\" Start of list of standard options for a Tk widget. The
61'\" options follow on successive lines, in four columns separated
62'\" by tabs.
63'\"
64'\" .SE
65'\" End of list of standard options for a Tk widget.
66'\"
67'\" .OP cmdName dbName dbClass
68'\" Start of description of a specific option. cmdName gives the
69'\" option's name as specified in the class command, dbName gives
70'\" the option's name in the option database, and dbClass gives
71'\" the option's class in the option database.
72'\"
73'\" .UL arg1 arg2
74'\" Print arg1 underlined, then print arg2 normally.
75'\"
76'\" RCS: @(#) $Id: man.macros,v 1.4 2000/08/25 06:18:32 ericm Exp $
77'\"
78'\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
79.if t .wh -1.3i ^B
80.nr ^l \n(.l
81.ad b
82'\" # Start an argument description
83.de AP
84.ie !"\\$4"" .TP \\$4
85.el \{\
86. ie !"\\$2"" .TP \\n()Cu
87. el .TP 15
88.\}
89.ta \\n()Au \\n()Bu
90.ie !"\\$3"" \{\
91\&\\$1 \\fI\\$2\\fP (\\$3)
92.\".b
93.\}
94.el \{\
95.br
96.ie !"\\$2"" \{\
97\&\\$1 \\fI\\$2\\fP
98.\}
99.el \{\
100\&\\fI\\$1\\fP
101.\}
102.\}
103..
104'\" # define tabbing values for .AP
105.de AS
106.nr )A 10n
107.if !"\\$1"" .nr )A \\w'\\$1'u+3n
108.nr )B \\n()Au+15n
109.\"
110.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
111.nr )C \\n()Bu+\\w'(in/out)'u+2n
112..
113.AS Tcl_Interp Tcl_CreateInterp in/out
114'\" # BS - start boxed text
115'\" # ^y = starting y location
116'\" # ^b = 1
117.de BS
118.br
119.mk ^y
120.nr ^b 1u
121.if n .nf
122.if n .ti 0
123.if n \l'\\n(.lu\(ul'
124.if n .fi
125..
126'\" # BE - end boxed text (draw box now)
127.de BE
128.nf
129.ti 0
130.mk ^t
131.ie n \l'\\n(^lu\(ul'
132.el \{\
133.\" Draw four-sided box normally, but don't draw top of
134.\" box if the box started on an earlier page.
135.ie !\\n(^b-1 \{\
136\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
137.\}
138.el \}\
139\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
140.\}
141.\}
142.fi
143.br
144.nr ^b 0
145..
146'\" # VS - start vertical sidebar
147'\" # ^Y = starting y location
148'\" # ^v = 1 (for troff; for nroff this doesn't matter)
149.de VS
150.if !"\\$2"" .br
151.mk ^Y
152.ie n 'mc \s12\(br\s0
153.el .nr ^v 1u
154..
155'\" # VE - end of vertical sidebar
156.de VE
157.ie n 'mc
158.el \{\
159.ev 2
160.nf
161.ti 0
162.mk ^t
163\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
164.sp -1
165.fi
166.ev
167.\}
168.nr ^v 0
169..
170'\" # Special macro to handle page bottom: finish off current
171'\" # box/sidebar if in box/sidebar mode, then invoked standard
172'\" # page bottom macro.
173.de ^B
174.ev 2
175'ti 0
176'nf
177.mk ^t
178.if \\n(^b \{\
179.\" Draw three-sided box if this is the box's first page,
180.\" draw two sides but no top otherwise.
181.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
182.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
183.\}
184.if \\n(^v \{\
185.nr ^x \\n(^tu+1v-\\n(^Yu
186\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
187.\}
188.bp
189'fi
190.ev
191.if \\n(^b \{\
192.mk ^y
193.nr ^b 2
194.\}
195.if \\n(^v \{\
196.mk ^Y
197.\}
198..
199'\" # DS - begin display
200.de DS
201.RS
202.nf
203.sp
204..
205'\" # DE - end display
206.de DE
207.fi
208.RE
209.sp
210..
211'\" # SO - start of list of standard options
212.de SO
213.SH "STANDARD OPTIONS"
214.LP
215.nf
216.ta 5.5c 11c
217.ft B
218..
219'\" # SE - end of list of standard options
220.de SE
221.fi
222.ft R
223.LP
224See the \\fBoptions\\fR manual entry for details on the standard options.
225..
226'\" # OP - start of full description for a single option
227.de OP
228.LP
229.nf
230.ta 4c
231Command-Line Name: \\fB\\$1\\fR
232Database Name: \\fB\\$2\\fR
233Database Class: \\fB\\$3\\fR
234.fi
235.IP
236..
237'\" # CS - begin code excerpt
238.de CS
239.RS
240.nf
241.ta .25i .5i .75i 1i
242..
243'\" # CE - end code excerpt
244.de CE
245.fi
246.RE
247..
248.de UL
249\\$1\l'|0\(ul'\\$2
250..
251.TH clock n 8.4 Tcl "Tcl Built-In Commands"
252.BS
253'\" Note: do not modify the .SH NAME line immediately below!
254.SH NAME
255clock \- Obtain and manipulate time
256.SH SYNOPSIS
257\fBclock \fIoption\fR ?\fIarg arg ...\fR?
258.BE
259
260.SH DESCRIPTION
261.PP
262This command performs one of several operations that may obtain
263or manipulate strings or values that represent some notion of
264time. The \fIoption\fR argument determines what action is carried
265out by the command. The legal \fIoptions\fR (which may be
266abbreviated) are:
267.VS 8.3
268.TP
269\fBclock clicks\fR ?\fB\-milliseconds\fR?
270Return a high-resolution time value as a system-dependent integer
271value. The unit of the value is system-dependent but should be the
272highest resolution clock available on the system such as a CPU cycle
273counter. If \fB\-milliseconds\fR is specified, then the value is
274guaranteed to be of millisecond granularity.
275This value should only be used for the relative measurement
276of elapsed time.
277.VE 8.3
278.TP
279\fBclock format \fIclockValue\fR ?\fB\-format \fIstring\fR? ?\fB\-gmt \fIboolean\fR?
280Converts an integer time value, typically returned by
281\fBclock seconds\fR, \fBclock scan\fR, or the \fBatime\fR or \fBmtime\fR
282options of the \fBfile\fR command, to human-readable
283form. If the \fB\-format\fR argument is present the next argument is a
284string that describes how the date and time are to be formatted.
285Field descriptors consist of a \fB%\fR followed by a field
286descriptor character. All other characters are copied into the result.
287Valid field descriptors are:
288.RS
289.IP \fB%%\fR
290Insert a %.
291.IP \fB%a\fR
292Abbreviated weekday name (Mon, Tue, etc.).
293.IP \fB%A\fR
294Full weekday name (Monday, Tuesday, etc.).
295.IP \fB%b\fR
296Abbreviated month name (Jan, Feb, etc.).
297.IP \fB%B\fR
298Full month name.
299.VS 8.4
300.IP \fB%c\fR
301Locale specific date and time. The format for date and time
302in the default "C" locale on Unix/Mac is "%a %b %d %H:%M:%S %Y".
303On Windows, this value is the locale specific long date and time, as
304specified in the Regional Options control panel settings.
305.IP \fB%C\fR
306First two digits of the four-digit year (19 or 20).
307.VE 8.4
308.IP \fB%d\fR
309Day of month (01 - 31).
310.VS 8.4
311'\" Since the inclusion of compat/strftime.c, %D, %e, %h should work on all
312'\" platforms.
313.IP \fB%D\fR
314Date as %m/%d/%y.
315.IP \fB%e\fR
316Day of month (1 - 31), no leading zeros.
317.IP \fB%g\fR
318The ISO8601 year number corresponding to the ISO8601 week (%V), expressed
319as a two-digit year-of-the-century, with leading zero if necessary.
320.IP \fB%G\fR
321The ISO8601 year number corresponding to the ISO8601 week (%V), expressed
322as a four-digit number.
323.IP \fB%h\fR
324Abbreviated month name.
325.VE 8.4
326.IP \fB%H\fR
327Hour in 24-hour format (00 - 23).
328.VS 8.4
329.IP \fB%I\fR
330Hour in 12-hour format (01 - 12).
331.VE 8.4
332.IP \fB%j\fR
333Day of year (001 - 366).
334.VS 8.4
335.IP \fB%k\fR
336Hour in 24-hour format, without leading zeros (0 - 23).
337.IP \fB%l\fR
338Hour in 12-hour format, without leading zeros (1 - 12).
339.VE 8.4
340.IP \fB%m\fR
341Month number (01 - 12).
342.IP \fB%M\fR
343Minute (00 - 59).
344.VS 8.4
345.IP \fB%n\fR
346Insert a newline.
347.VE 8.4
348.IP \fB%p\fR
349AM/PM indicator.
350.VS 8.4
351.IP \fB%r\fR
352Time in a locale-specific "meridian" format. The "meridian"
353format in the default "C" locale is "%I:%M:%S %p".
354.IP \fB%R\fR
355Time as %H:%M.
356.IP \fB%s\fR
357Count of seconds since the epoch, expressed as a decimal integer.
358.VE 8.4
359.IP \fB%S\fR
360Seconds (00 - 59).
361.VS 8.4
362.IP \fB%t\fR
363Insert a tab.
364.IP \fB%T\fR
365Time as %H:%M:%S.
366.IP \fB%u\fR
367Weekday number (Monday = 1, Sunday = 7).
368.VE 8.4
369.IP \fB%U\fR
370Week of year (00 - 52), Sunday is the first day of the week.
371.VS 8.4
372.IP \fB%V\fR
373Week of year according to ISO-8601 rules. Week 1 of a given
374year is the week containing 4 January.
375.IP \fB%w\fR
376Weekday number (Sunday = 0, Saturday = 6).
377.VE 8.4
378.IP \fB%W\fR
379Week of year (00 - 52), Monday is the first day of the week.
380.VS 8.4
381.IP \fB%x\fR
382Locale specific date format. The format for a date in the default "C"
383locale for Unix/Mac is "%m/%d/%y".
384On Windows, this value is the locale specific short date format, as
385specified in the Regional Options control panel settings.
386.IP \fB%X\fR
387Locale specific 24-hour time format. The format for a
38824-hour time in the default "C" locale for Unix/Mac is "%H:%M:%S".
389On Windows, this value is the locale specific time format, as
390specified in the Regional Options control panel settings.
391.VE 8.4
392.IP \fB%y\fR
393Year without century (00 - 99).
394.IP \fB%Y\fR
395Year with century (e.g. 1990)
396.IP \fB%Z\fR
397Time zone name.
398.RE
399.VS 8.4
400.sp
401'\" All the field descriptors should be portable now that
402'\" compat/strftime.c is in place, with the possible exception
403'\" of the time zone name.
404'\".RS
405'\"In addition, the following field descriptors may be supported on some
406'\"systems (e.g. Unix but not Windows):
407'\".IP \fB%D\fR
408'\"Date as %m/%d/%y.
409'\".IP \fB%e\fR
410'\"Day of month (1 - 31), no leading zeros.
411'\".IP \fB%h\fR
412'\"Abbreviated month name.
413'\".IP \fB%n\fR
414'\"Insert a newline.
415'\".IP \fB%r\fR
416'\"Time as %I:%M:%S %p.
417'\".IP \fB%R\fR
418'\"Time as %H:%M.
419'\".IP \fB%t\fR
420'\"Insert a tab.
421'\".IP \fB%T\fR
422'\"Time as %H:%M:%S.
423'\".RE
424'\".sp
425.VE 8.4
426.RS
427If the \fB\-format\fR argument is not specified, the format string
428\fB"%a %b %d %H:%M:%S %Z %Y"\fR is used. If the \fB\-gmt\fR argument
429is present the next argument must be a boolean which if true specifies
430that the time will be formatted as Greenwich Mean Time. If false
431then the local timezone will be used as defined by the operating
432environment.
433.RE
434.TP
435\fBclock scan \fIdateString\fR ?\fB\-base \fIclockVal\fR? ?\fB\-gmt \fIboolean\fR?
436Convert \fIdateString\fR to an integer clock value (see \fBclock seconds\fR).
437This command can parse and convert virtually any standard date and/or time
438string, which can include standard time zone mnemonics. If only a time is
439specified, the current date is assumed. If the string does not contain a
440time zone mnemonic, the local time zone is assumed, unless the \fB\-gmt\fR
441argument is true, in which case the clock value is calculated assuming
442that the specified time is relative to Greenwich Mean Time.
443\fB-gmt\fR, if specified, affects only the computed time value; it does not
444impact the interpretation of \fB-base\fR.
445.sp
446If the \fB\-base\fR flag is specified, the next argument should contain
447an integer clock value. Only the date in this value is used, not the
448time. This is useful for determining the time on a specific day or
449doing other date-relative conversions.
450.sp
451The \fIdateString\fR consists of zero or more specifications of the
452following form:
453.RS
454.TP
455\fItime\fR
456A time of day, which is of the form: \fIhh\fR?\fI:mm\fR?\fI:ss\fR??
457?\fImeridian\fR? ?\fIzone\fR? or \fIhhmm \fR?\fImeridian\fR?
458?\fIzone\fR?. If no meridian is specified, \fIhh\fR is interpreted on
459a 24-hour clock.
460.TP
461\fIdate\fR
462A specific month and day with optional year. The
463acceptable formats are \fImm/dd\fR?\fI/yy\fR?, \fImonthname dd\fR
464?, \fIyy\fR?, \fIdd monthname \fR?\fIyy\fR?, \fIday, dd monthname
465yy\fR, \fI?CC?yymmdd\fR, \fI?CC?yy-mm-dd\fR, \fIdd-monthname-?CC?yy\fR.
466The default year is the current year. If the year is less
467.VS
468than 100, we treat the years 00-68 as 2000-2068 and the years 69-99
469as 1969-1999. Not all platforms can represent the years 38-70, so
470an error may result if these years are used.
471.VE
472.TP
473\fIISO 8601 point-in-time\fR
474An ISO 8601 point-in-time specification, such as \fICCyymmddThhmmss\fR, where
475T is the literal T, \fICCyymmdd hhmmss\fR, or
476\fICCyymmddThh:mm:ss\fR. Note that only these three formats are accepted.
477The command does \fInot\fR accept the full range of point-in-time
478specifications specified in ISO8601. Other formats can be recognized by
479using commands such as \fBregexp\fR to extract their fields and reorganize
480them into a form accepted by the \fBclock scan\fR command.
481.TP
482\fIrelative time\fR
483A specification relative to the current time. The format is \fInumber
484unit\fR acceptable units are \fByear\fR, \fBfortnight\fR, \fBmonth\fR, \fBweek\fR, \fBday\fR,
485\fBhour\fR, \fBminute\fR (or \fBmin\fR), and \fBsecond\fR (or \fBsec\fR). The
486unit can be specified as a singular or plural, as in \fB3 weeks\fR.
487These modifiers may also be specified:
488\fBtomorrow\fR, \fByesterday\fR, \fBtoday\fR, \fBnow\fR,
489\fBlast\fR, \fBthis\fR, \fBnext\fR, \fBago\fR.
490.RE
491.sp
492.RS
493The actual date is calculated according to the following steps.
494First, any absolute date and/or time is processed and converted.
495Using that time as the base, day-of-week specifications are added.
496Next, relative specifications are used. If a date or day is
497specified, and no absolute or relative time is given, midnight is
498used. Finally, a correction is applied so that the correct hour of
499the day is produced after allowing for daylight savings time
500differences and the correct date is given when going from the end
501of a long month to a short month.
502.sp
503Daylight savings time correction is applied only when the relative time
504is specified in units of days or more, ie, days, weeks, fortnights, months or
505years. This means that when crossing the daylight savings time boundary,
506different results will be given for \fBclock scan "1 day"\fR and
507\fBclock scan "24 hours"\fR:
508.CS
509.ta 6c
510% \fBclock scan\fR "1 day" -base [\fBclock scan\fR 1999-10-31]
511941443200
512% \fBclock scan\fR "24 hours" -base [\fBclock scan\fR 1999-10-31]
513941439600
514.CE
515.RE
516.TP
517\fBclock seconds\fR
518Return the current date and time as a system-dependent integer value. The
519unit of the value is seconds, allowing it to be used for relative time
520calculations. The value is usually defined as total elapsed time from
521an ``epoch''. You shouldn't assume the value of the epoch.
522
523.SH "SEE ALSO"
524date(1), time(n)
525
526.SH KEYWORDS
527clock, date, time