OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [insight/] [tcl/] [doc/] [clock.n] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1992-1995 Karl Lehenbauer and Mark Diekhans.
3
'\" Copyright (c) 1995-1997 Sun Microsystems, Inc.
4
'\"
5
'\" This documentation is derived from the time and date facilities of
6
'\" TclX, by Mark Diekhans and Karl Lehenbauer.
7
'\"
8
'\" See the file "license.terms" for information on usage and redistribution
9
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10
'\"
11
'\" RCS: @(#) $Id: clock.n,v 1.1.1.1 2002-01-16 10:25:24 markom Exp $
12
'\"
13
.so man.macros
14
.TH clock n 7.4 Tcl "Tcl Built-In Commands"
15
.BS
16
'\" Note:  do not modify the .SH NAME line immediately below!
17
.SH NAME
18
clock \- Obtain and manipulate time
19
.SH SYNOPSIS
20
\fBclock \fIoption\fR ?\fIarg arg ...\fR?
21
.BE
22
 
23
.SH DESCRIPTION
24
.PP
25
This command performs one of several operations that may obtain
26
or manipulate strings or values that represent some notion of
27
time.  The \fIoption\fR argument determines what action is carried
28
out by the command.  The legal \fIoptions\fR (which may be
29
abbreviated) are:
30
.TP
31
\fBclock clicks\fR
32
Return a high-resolution time value as a system-dependent integer
33
value.  The unit of the value is system-dependent but should be the
34
highest resolution clock available on the system such as a CPU cycle
35
counter. This value should only be used for the relative measurement
36
of elapsed time.
37
.TP
38
\fBclock format \fIclockValue\fR ?\fB\-format \fIstring\fR? ?\fB\-gmt \fIboolean\fR?
39
Converts an integer time value, typically returned by
40
\fBclock seconds\fR, \fBclock scan\fR, or the \fBatime\fR, \fBmtime\fR,
41
or \fBctime\fR options of the \fBfile\fR command, to human-readable
42
form.  If the \fB\-format\fR argument is present the next argument is a
43
string that describes how the date and time are to be formatted.
44
Field descriptors consist of a \fB%\fR followed by a field
45
descriptor character.  All other characters are copied into the result.
46
Valid field descriptors are:
47
.RS
48
.IP \fB%%\fR
49
Insert a %.
50
.IP \fB%a\fR
51
Abbreviated weekday name (Mon, Tue, etc.).
52
.IP \fB%A\fR
53
Full weekday name (Monday, Tuesday, etc.).
54
.IP \fB%b\fR
55
Abbreviated month name (Jan, Feb, etc.).
56
.IP \fB%B\fR
57
Full month name.
58
.IP \fB%c\fR
59
Locale specific date and time.
60
.IP \fB%d\fR
61
Day of month (01 - 31).
62
.IP \fB%H\fR
63
Hour in 24-hour format (00 - 23).
64
.IP \fB%I\fR
65
Hour in 12-hour format (00 - 12).
66
.IP \fB%j\fR
67
Day of year (001 - 366).
68
.IP \fB%m\fR
69
Month number (01 - 12).
70
.IP \fB%M\fR
71
Minute (00 - 59).
72
.IP \fB%p\fR
73
AM/PM indicator.
74
.IP \fB%S\fR
75
Seconds (00 - 59).
76
.IP \fB%U\fR
77
Week of year (01 - 52), Sunday is the first day of the week.
78
.IP \fB%w\fR
79
Weekday number (Sunday = 0).
80
.IP \fB%W\fR
81
Week of year (01 - 52), Monday is the first day of the week.
82
.IP \fB%x\fR
83
Locale specific date format.
84
.IP \fB%X\fR
85
Locale specific time format.
86
.IP \fB%y\fR
87
Year without century (00 - 99).
88
.IP \fB%Y\fR
89
Year with century (e.g. 1990)
90
.IP \fB%Z\fR
91
Time zone name.
92
.RE
93
.sp
94
.RS
95
In addition, the following field descriptors may be supported on some
96
systems (e.g. Unix but not Windows):
97
.IP \fB%D\fR
98
Date as %m/%d/%y.
99
.IP \fB%e\fR
100
Day of month (1 - 31), no leading zeros.
101
.IP \fB%h\fR
102
Abbreviated month name.
103
.IP \fB%n\fR
104
Insert a newline.
105
.IP \fB%r\fR
106
Time as %I:%M:%S %p.
107
.IP \fB%R\fR
108
Time as %H:%M.
109
.IP \fB%t\fR
110
Insert a tab.
111
.IP \fB%T\fR
112
Time as %H:%M:%S.
113
.RE
114
.sp
115
.RS
116
If the \fB\-format\fR argument is not specified, the format string
117
"\fB%a %b %d %H:%M:%S %Z %Y\fR" is used.  If the \fB\-gmt\fR argument
118
is present the next argument must be a boolean which if true specifies
119
that the time will be formatted as Greenwich Mean Time. If false
120
then the local timezone will be used as defined by the operating
121
environment.
122
.RE
123
.TP
124
\fBclock scan \fIdateString\fR ?\fB\-base \fIclockVal\fR? ?\fB\-gmt \fIboolean\fR?
125
Convert \fIdateString\fR to an integer clock value (see \fBclock seconds\fR).
126
This command can parse and convert virtually any standard date and/or time
127
string, which can include standard time zone mnemonics.  If only a time is
128
specified, the current date is assumed.  If the string does not contain a
129
time zone mnemonic, the local time zone is assumed, unless the \fB\-gmt\fR
130
argument is true, in which case the clock value is calculated assuming
131
that the specified time is relative to Greenwich Mean Time.
132
.sp
133
If the \fB\-base\fR flag is specified, the next argument should contain
134
an integer clock value.  Only the date in this value is used, not the
135
time.  This is useful for determining the time on a specific day or
136
doing other date-relative conversions.
137
.sp
138
The \fIdateString\fR consists of zero or more specifications of the
139
following form:
140
.RS
141
.TP
142
\fItime\fR
143
A time of day, which is of the form: \fIhh\fR?\fI:mm\fR?\fI:ss\fR??
144
?\fImeridian\fR? ?\fIzone\fR? or \fIhhmm \fR?\fImeridian\fR?
145
?\fIzone\fR?. If no meridian is specified, \fIhh\fR is interpreted on
146
a 24-hour clock.
147
.TP
148
\fIdate\fR
149
A specific month and day with optional year.  The
150
acceptable formats are \fImm/dd\fR?\fI/yy\fR?, \fImonthname dd\fR
151
?, \fIyy\fR?, \fIdd monthname \fR?\fIyy\fR? and \fIday, dd monthname
152
yy\fR.  The default year is the current year.  If the year is less
153
.VS
154
than 100, we treat the years 00-68 as 2000-2068 and the years 69-99
155
as 1969-1999.  Not all platforms can represent the years 38-70, so
156
an error may result if these years are used.
157
.VE
158
.TP
159
\fIrelative time\fR
160
A specification relative to the current time.  The format is \fInumber
161
unit\fR acceptable units are \fByear\fR, \fBfortnight\fR, \fBmonth\fR, \fBweek\fR, \fBday\fR,
162
\fBhour\fR, \fBminute\fR (or \fBmin\fR), and \fBsecond\fR (or \fBsec\fR).  The
163
unit can be specified as a singular or plural, as in \fB3 weeks\fR.
164
These modifiers may also be specified:
165
\fBtomorrow\fR, \fByesterday\fR, \fBtoday\fR, \fBnow\fR,
166
\fBlast\fR, \fBthis\fR, \fBnext\fR, \fBago\fR.
167
.RE
168
.sp
169
.RS
170
The actual date is calculated according to the following steps.
171
First, any absolute date and/or time is processed and converted.
172
Using that time as the base, day-of-week specifications are added.
173
Next, relative specifications are used.  If a date or day is
174
specified, and no absolute or relative time is given, midnight is
175
used.  Finally, a correction is applied so that the correct hour of
176
the day is produced after allowing for daylight savings time
177
differences and the correct date is given when going from the end
178
of a long month to a short month.
179
.RE
180
.TP
181
\fBclock seconds\fR
182
Return the current date and time as a system-dependent integer value.  The
183
unit of the value is seconds, allowing it to be used for relative time
184
calculations.  The value is usually defined as total elapsed time from
185
an ``epoch''.  You shouldn't assume the value of the epoch.
186
 
187
.SH KEYWORDS
188
clock, date, time

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.