⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clock.n

📁 tcl是工具命令语言
💻 N
字号:
'\"'\" Copyright (c) 1992-1995 Karl Lehenbauer and Mark Diekhans.'\" Copyright (c) 1995-1997 Sun Microsystems, Inc.'\" Copyright (c) 1998-1999 Scriptics Corporation'\" Copyright (c) 2002 ActiveState Corporation'\"'\" This documentation is derived from the time and date facilities of'\" TclX, by Mark Diekhans and Karl Lehenbauer.'\" '\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" RCS: @(#) $Id: clock.n,v 1.11 2002/04/22 22:41:46 hobbs Exp $'\" .so man.macros.TH clock n 8.4 Tcl "Tcl Built-In Commands".BS'\" Note:  do not modify the .SH NAME line immediately below!.SH NAMEclock \- Obtain and manipulate time.SH SYNOPSIS\fBclock \fIoption\fR ?\fIarg arg ...\fR?.BE.SH DESCRIPTION.PPThis command performs one of several operations that may obtainor manipulate strings or values that represent some notion oftime.  The \fIoption\fR argument determines what action is carriedout by the command.  The legal \fIoptions\fR (which may beabbreviated) are:.TP.VS 8.3\fBclock clicks\fR ?\fB\-milliseconds\fR?Return a high-resolution time value as a system-dependent integervalue.  The unit of the value is system-dependent but should be thehighest resolution clock available on the system such as a CPU cyclecounter. If \fB\-milliseconds\fR is specified, then the value isguaranteed to be of millisecond granularity.This value should only be used for the relative measurementof elapsed time..VE 8.3.TP\fBclock format \fIclockValue\fR ?\fB\-format \fIstring\fR? ?\fB\-gmt \fIboolean\fR?Converts an integer time value, typically returned by\fBclock seconds\fR, \fBclock scan\fR, or the \fBatime\fR, \fBmtime\fR,or \fBctime\fR options of the \fBfile\fR command, to human-readableform.  If the \fB\-format\fR argument is present the next argument is astring that describes how the date and time are to be formatted.Field descriptors consist of a \fB%\fR followed by a fielddescriptor character.  All other characters are copied into the result.Valid field descriptors are:.RS.IP \fB%%\fRInsert a %..IP \fB%a\fRAbbreviated weekday name (Mon, Tue, etc.)..IP \fB%A\fRFull weekday name (Monday, Tuesday, etc.)..IP \fB%b\fRAbbreviated month name (Jan, Feb, etc.)..IP \fB%B\fRFull month name..VS 8.4.IP \fB%c\fRLocale specific date and time.  The format for date and timein the default "C" locale on Unix/Mac is "%a %b %d %H:%M:%S %Y".On Windows, this value is the locale specific long date and time, asspecified in the Regional Options control panel settings..IP \fB%C\fRFirst two digits of the four-digit year (19 or 20)..VE 8.4.IP \fB%d\fRDay of month (01 - 31)..VS 8.4'\" Since the inclusion of compat/strftime.c, %D, %e, %h should work on all'\" platforms..IP \fB%D\fRDate as %m/%d/%y..IP \fB%e\fRDay of month (1 - 31), no leading zeros..IP \fB%h\fRAbbreviated month name..VE 8.4.IP \fB%H\fRHour in 24-hour format (00 - 23)..VS 8.4.IP \fB%I\fRHour in 12-hour format (01 - 12)..VE 8.4.IP \fB%j\fRDay of year (001 - 366)..VS 8.4.IP \fB%k\fRHour in 24-hour format, without leading zeros (0 - 23)..IP \fB%l\fRHour in 12-hour format, without leading zeros (1 - 12)..VE 8.4.IP \fB%m\fRMonth number (01 - 12)..IP \fB%M\fRMinute (00 - 59)..VS 8.4.IP \fB%n\fRInsert a newline..VE 8.4.IP \fB%p\fRAM/PM indicator..VS 8.4.IP \fB%r\fRTime in a locale-specific "meridian" format.  The "meridian"format in the default "C" locale is "%I:%M:%S %p"..IP \fB%R\fRTime as %H:%M..IP \fB%s\fRCount of seconds since the epoch, expressed as a decimal integer..VE 8.4.IP \fB%S\fRSeconds (00 - 59)..VS 8.4.IP \fB%t\fRInsert a tab..IP \fB%T\fRTime as %H:%M:%S..IP \fB%u\fRWeekday number (Monday = 1, Sunday = 7)..VE 8.4.IP \fB%U\fRWeek of year (00 - 52), Sunday is the first day of the week..VS 8.4.IP \fB%V\fRWeek of year according to ISO-8601 rules.  Week 1 of a givenyear is the week containing 4 January..IP \fB%w\fRWeekday number (Sunday = 0, Saturday = 6)..VE 8.4.IP \fB%W\fRWeek of year (00 - 52), Monday is the first day of the week..VS 8.4.IP \fB%x\fRLocale specific date format.  The format for a date in the default "C"locale for Unix/Mac is "%m/%d/%y".On Windows, this value is the locale specific short date format, asspecified in the Regional Options control panel settings..IP \fB%X\fRLocale specific 24-hour time format.  The format for a 24-hour time in the default "C" locale for Unix/Mac is "%H:%M:%S".On Windows, this value is the locale specific time format, asspecified in the Regional Options control panel settings..VE 8.4.IP \fB%y\fRYear without century (00 - 99)..IP \fB%Y\fRYear with century (e.g. 1990).IP \fB%Z\fRTime zone name..RE.VS 8.4.sp'\" All the field descriptors should be portable now that'\" compat/strftime.c is in place, with the possible exception'\" of the time zone name.'\".RS'\"In addition, the following field descriptors may be supported on some'\"systems (e.g. Unix but not Windows):'\".IP \fB%D\fR'\"Date as %m/%d/%y.'\".IP \fB%e\fR'\"Day of month (1 - 31), no leading zeros.'\".IP \fB%h\fR'\"Abbreviated month name.'\".IP \fB%n\fR'\"Insert a newline.'\".IP \fB%r\fR'\"Time as %I:%M:%S %p.'\".IP \fB%R\fR'\"Time as %H:%M.'\".IP \fB%t\fR'\"Insert a tab.'\".IP \fB%T\fR'\"Time as %H:%M:%S.'\".RE'\".sp.VE 8.4.RSIf the \fB\-format\fR argument is not specified, the format string \fB"%a %b %d %H:%M:%S %Z %Y"\fR is used.  If the \fB\-gmt\fR argumentis present the next argument must be a boolean which if true specifiesthat the time will be formatted as Greenwich Mean Time. If falsethen the local timezone will be used as defined by the operatingenvironment..RE.TP\fBclock scan \fIdateString\fR ?\fB\-base \fIclockVal\fR? ?\fB\-gmt \fIboolean\fR?Convert \fIdateString\fR to an integer clock value (see \fBclock seconds\fR).This command can parse and convert virtually any standard date and/or timestring, which can include standard time zone mnemonics.  If only a time isspecified, the current date is assumed.  If the string does not contain atime zone mnemonic, the local time zone is assumed, unless the \fB\-gmt\fR argument is true, in which case the clock value is calculated assumingthat the specified time is relative to Greenwich Mean Time.\fB-gmt\fR, if specified, affects only the computed time value; it does notimpact the interpretation of \fB-base\fR..spIf the \fB\-base\fR flag is specified, the next argument should containan integer clock value.  Only the date in this value is used, not thetime.  This is useful for determining the time on a specific day ordoing other date-relative conversions..spThe \fIdateString\fR consists of zero or more specifications of thefollowing form:.RS.TP\fItime\fRA time of day, which is of the form: \fIhh\fR?\fI:mm\fR?\fI:ss\fR?? ?\fImeridian\fR? ?\fIzone\fR? or \fIhhmm \fR?\fImeridian\fR? ?\fIzone\fR?. If no meridian is specified, \fIhh\fR is interpreted ona 24-hour clock..TP\fIdate\fRA specific month and day with optional year.  Theacceptable formats are \fImm/dd\fR?\fI/yy\fR?, \fImonthname dd\fR?, \fIyy\fR?, \fIdd monthname \fR?\fIyy\fR?, \fIday, dd monthnameyy\fR, \fI?CC?yymmdd\fR, \fI?CC?yy-mm-dd\fR, \fIdd-monthname-?CC?yy\fR.The default year is the current year.  If the year is less.VSthan 100, we treat the years 00-68 as 2000-2068 and the years 69-99as 1969-1999.  Not all platforms can represent the years 38-70, soan error may result if these years are used..VE.TP\fIISO 8601 point-in-time\fRAn ISO 8601 point-in-time specification, such as \fICCyymmddThhmmss\fR, whereT is the literal T, \fICCyymmdd hhmmss\fR, or \fICCyymmddThh:mm:ss\fR..TP\fIrelative time\fRA specification relative to the current time.  The format is \fInumberunit\fR acceptable units are \fByear\fR, \fBfortnight\fR, \fBmonth\fR, \fBweek\fR, \fBday\fR,\fBhour\fR, \fBminute\fR (or \fBmin\fR), and \fBsecond\fR (or \fBsec\fR).  Theunit can be specified as a singular or plural, as in \fB3 weeks\fR.These modifiers may also be specified:\fBtomorrow\fR, \fByesterday\fR, \fBtoday\fR, \fBnow\fR,\fBlast\fR, \fBthis\fR, \fBnext\fR, \fBago\fR..RE.sp.RSThe actual date is calculated according to the following steps.First, any absolute date and/or time is processed and converted.Using that time as the base, day-of-week specifications are added.Next, relative specifications are used.  If a date or day isspecified, and no absolute or relative time is given, midnight isused.  Finally, a correction is applied so that the correct hour ofthe day is produced after allowing for daylight savings timedifferences and the correct date is given when going from the endof a long month to a short month..spDaylight savings time correction is applied only when the relative timeis specified in units of days or more, ie, days, weeks, fortnights, months oryears.  This means that when crossing the daylight savings time boundary,different results will be given for \fBclock scan "1 day"\fR and\fBclock scan "24 hours"\fR:.CS.ta 6c\fB% clock scan "1 day" -base [clock scan 1999-10-31]941443200% clock scan "24 hours" -base [clock scan 1999-10-31]941439600\fR.CE.RE.TP\fBclock seconds\fRReturn the current date and time as a system-dependent integer value.  Theunit of the value is seconds, allowing it to be used for relative timecalculations.  The value is usually defined as total elapsed time froman ``epoch''.  You shouldn't assume the value of the epoch..SH "SEE ALSO"date(1), time(n).SH KEYWORDSclock, date, time

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -