Skip to content

Commit b19a552

Browse files
Deploy preview for PR 1231 🛫
1 parent 1d5bbd5 commit b19a552

584 files changed

Lines changed: 717 additions & 667 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pr-preview/pr-1231/_sources/library/time.rst.txt

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,24 @@ An explanation of some terminology and conventions is in order.
122122
Functions
123123
---------
124124

125-
.. function:: asctime([t])
125+
.. function:: asctime([time_tuple])
126126

127127
Convert a tuple or :class:`struct_time` representing a time as returned by
128128
:func:`gmtime` or :func:`localtime` to a string of the following
129129
form: ``'Sun Jun 20 23:21:05 1993'``. The day field is two characters long
130130
and is space padded if the day is a single digit,
131-
e.g.: ``'Wed Jun 9 04:26:40 1993'``.
131+
for example: ``'Wed Jun 9 04:26:40 1993'``.
132132

133-
If *t* is not provided, the current time as returned by :func:`localtime`
134-
is used. Locale information is not used by :func:`asctime`.
133+
If *time_tuple* is not provided,
134+
the current time as returned by :func:`localtime` is used.
135+
Locale information is not used by :func:`asctime`.
135136

136137
.. note::
137138

138139
Unlike the C function of the same name, :func:`asctime` does not add a
139140
trailing newline.
140141

141-
.. function:: pthread_getcpuclockid(thread_id)
142+
.. function:: pthread_getcpuclockid(thread_id, /)
142143

143144
Return the *clk_id* of the thread-specific CPU-time clock for the specified *thread_id*.
144145

@@ -157,7 +158,7 @@ Functions
157158

158159
.. versionadded:: 3.7
159160

160-
.. function:: clock_getres(clk_id)
161+
.. function:: clock_getres(clk_id, /)
161162

162163
Return the resolution (precision) of the specified clock *clk_id*. Refer to
163164
:ref:`time-clock-id-constants` for a list of accepted values for *clk_id*.
@@ -167,7 +168,7 @@ Functions
167168
.. versionadded:: 3.3
168169

169170

170-
.. function:: clock_gettime(clk_id) -> float
171+
.. function:: clock_gettime(clk_id, /) -> float
171172

172173
Return the time of the specified clock *clk_id*. Refer to
173174
:ref:`time-clock-id-constants` for a list of accepted values for *clk_id*.
@@ -180,7 +181,7 @@ Functions
180181
.. versionadded:: 3.3
181182

182183

183-
.. function:: clock_gettime_ns(clk_id) -> int
184+
.. function:: clock_gettime_ns(clk_id, /) -> int
184185

185186
Similar to :func:`clock_gettime` but return time as nanoseconds.
186187

@@ -189,7 +190,7 @@ Functions
189190
.. versionadded:: 3.7
190191

191192

192-
.. function:: clock_settime(clk_id, time: float)
193+
.. function:: clock_settime(clk_id, time: float, /)
193194

194195
Set the time of the specified clock *clk_id*. Currently,
195196
:data:`CLOCK_REALTIME` is the only accepted value for *clk_id*.
@@ -202,7 +203,7 @@ Functions
202203
.. versionadded:: 3.3
203204

204205

205-
.. function:: clock_settime_ns(clk_id, time: int)
206+
.. function:: clock_settime_ns(clk_id, time: int, /)
206207

207208
Similar to :func:`clock_settime` but set time with nanoseconds.
208209

@@ -211,20 +212,20 @@ Functions
211212
.. versionadded:: 3.7
212213

213214

214-
.. function:: ctime([secs])
215+
.. function:: ctime(seconds=None, /)
215216

216217
Convert a time expressed in seconds since the epoch_ to a string of a form:
217218
``'Sun Jun 20 23:21:05 1993'`` representing local time. The day field
218219
is two characters long and is space padded if the day is a single digit,
219-
e.g.: ``'Wed Jun 9 04:26:40 1993'``.
220+
for example: ``'Wed Jun 9 04:26:40 1993'``.
220221

221-
If *secs* is not provided or :const:`None`, the current time as
222-
returned by :func:`.time` is used. ``ctime(secs)`` is equivalent to
223-
``asctime(localtime(secs))``. Locale information is not used by
222+
If *seconds* is not provided or :const:`None`, the current time as
223+
returned by :func:`.time` is used. ``ctime(seconds)`` is equivalent to
224+
``asctime(localtime(seconds))``. Locale information is not used by
224225
:func:`ctime`.
225226

226227

227-
.. function:: get_clock_info(name)
228+
.. function:: get_clock_info(name, /)
228229

229230
Get information on the specified clock as a namespace object.
230231
Supported clock names and the corresponding functions to read their value
@@ -249,21 +250,22 @@ Functions
249250
.. versionadded:: 3.3
250251

251252

252-
.. function:: gmtime([secs])
253+
.. function:: gmtime(seconds=None, /)
253254

254255
Convert a time expressed in seconds since the epoch_ to a :class:`struct_time` in
255-
UTC in which the dst flag is always zero. If *secs* is not provided or
256+
UTC in which the dst flag is always zero. If *seconds* is not provided or
256257
:const:`None`, the current time as returned by :func:`.time` is used. Fractions
257258
of a second are ignored. See above for a description of the
258259
:class:`struct_time` object. See :func:`calendar.timegm` for the inverse of this
259260
function.
260261

261262

262-
.. function:: localtime([secs])
263+
.. function:: localtime(seconds=None, /)
263264

264-
Like :func:`gmtime` but converts to local time. If *secs* is not provided or
265-
:const:`None`, the current time as returned by :func:`.time` is used. The dst
266-
flag is set to ``1`` when DST applies to the given time.
265+
Like :func:`gmtime` but converts to local time.
266+
If *seconds* is not provided or :const:`None`,
267+
the current time as returned by :func:`.time` is used.
268+
The dst flag is set to ``1`` when DST applies to the given time.
267269

268270
:func:`localtime` may raise :exc:`OverflowError`, if the timestamp is
269271
outside the range of values supported by the platform C :c:func:`localtime`
@@ -272,7 +274,7 @@ Functions
272274
between 1970 and 2038.
273275

274276

275-
.. function:: mktime(t)
277+
.. function:: mktime(time_tuple, /)
276278

277279
This is the inverse function of :func:`localtime`. Its argument is the
278280
:class:`struct_time` or full 9-tuple (since the dst flag is needed; use ``-1``
@@ -379,7 +381,7 @@ Functions
379381

380382
.. versionadded:: 3.7
381383

382-
.. function:: sleep(secs)
384+
.. function:: sleep(seconds, /)
383385

384386
Suspend execution of the calling thread for the given number of seconds.
385387
The argument may be a floating-point number to indicate a more precise sleep
@@ -393,13 +395,16 @@ Functions
393395

394396
.. rubric:: Windows implementation
395397

396-
On Windows, if *secs* is zero, the thread relinquishes the remainder of its
397-
time slice to any other thread that is ready to run. If there are no other
398-
threads ready to run, the function returns immediately, and the thread
399-
continues execution. On Windows 10 and newer the implementation uses
398+
On Windows, if *seconds* is zero,
399+
the thread relinquishes the remainder of its time slice
400+
to any other thread that is ready to run.
401+
If there are no other threads ready to run,
402+
the function returns immediately, and the thread continues execution.
403+
On Windows 10 and newer the implementation uses
400404
a `high-resolution timer
401405
<https://learn.microsoft.com/windows/win32/api/synchapi/nf-synchapi-createwaitabletimerexw>`_
402-
which provides resolution of 100 nanoseconds. If *secs* is zero, ``Sleep(0)`` is used.
406+
which provides resolution of 100 nanoseconds.
407+
If *seconds* is zero, ``Sleep(0)`` is used.
403408

404409
.. rubric:: Unix implementation
405410

@@ -414,12 +419,13 @@ Functions
414419
To voluntarily relinquish the CPU, specify a real-time :ref:`scheduling
415420
policy <os-scheduling-policy>` and use :func:`os.sched_yield` instead.
416421

417-
.. audit-event:: time.sleep secs
422+
.. audit-event:: time.sleep seconds
418423

419424
.. versionchanged:: 3.5
420-
The function now sleeps at least *secs* even if the sleep is interrupted
421-
by a signal, except if the signal handler raises an exception (see
422-
:pep:`475` for the rationale).
425+
The function now sleeps at least *seconds*
426+
even if the sleep is interrupted by a signal,
427+
except if the signal handler raises an exception
428+
(see :pep:`475` for the rationale).
423429

424430
.. versionchanged:: 3.11
425431
On Unix, the ``clock_nanosleep()`` and ``nanosleep()`` functions are now
@@ -431,13 +437,13 @@ Functions
431437
.. index::
432438
single: % (percent); datetime format
433439

434-
.. function:: strftime(format[, t])
440+
.. function:: strftime(format[, time_tuple])
435441

436442
Convert a tuple or :class:`struct_time` representing a time as returned by
437443
:func:`gmtime` or :func:`localtime` to a string as specified by the *format*
438-
argument. If *t* is not provided, the current time as returned by
444+
argument. If *time_tuple* is not provided, the current time as returned by
439445
:func:`localtime` is used. *format* must be a string. :exc:`ValueError` is
440-
raised if any field in *t* is outside of the allowed range.
446+
raised if any field in *time_tuple* is outside of the allowed range.
441447

442448
0 is a legal argument for any position in the time tuple; if it is normally
443449
illegal the value is forced to a correct one.

pr-preview/pr-1231/about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ <h3>導航</h3>
356356
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
357357
<br>
358358
<br>
359-
最後更新於 8月 15, 2026 (00:17 UTC)。
359+
最後更新於 8月 16, 2026 (00:17 UTC)。
360360

361361
<a href="/bugs.html">發現 bug</a>
362362

pr-preview/pr-1231/bugs.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ <h2>說明文件的錯誤<a class="headerlink" href="#documentation-bugs" title=
250250
</section>
251251
<section id="getting-started-contributing-to-python-yourself">
252252
<span id="contributing-to-python"></span><h2>開始讓自己貢獻 Python<a class="headerlink" href="#getting-started-contributing-to-python-yourself" title="連結到這個標頭"></a></h2>
253-
<p>除了只是回報你所發現的錯誤之外,同樣也歡迎你提交修正它們的修補程式 (patch)。你可以在 <a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果你有任何問題,<a class="reference external" href="https://devguide.python.org/">核心導師郵寄清單</a>是一個友善的地方,你可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
253+
<p>除了只是回報你所發現的錯誤之外,同樣也歡迎你提交修正它們的修補程式 (patch)。你可以在 <a class="reference external" href="https://devguide.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果你有任何問題,<a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">核心導師郵寄清單</a>是一個友善的地方,你可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
254254
</section>
255255
</section>
256256

@@ -393,7 +393,7 @@ <h3>導航</h3>
393393
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
394394
<br>
395395
<br>
396-
最後更新於 8月 15, 2026 (00:17 UTC)。
396+
最後更新於 8月 16, 2026 (00:17 UTC)。
397397

398398
<a href="/bugs.html">發現 bug</a>
399399

pr-preview/pr-1231/c-api/abstract.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ <h3>導航</h3>
365365
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
366366
<br>
367367
<br>
368-
最後更新於 8月 15, 2026 (00:17 UTC)。
368+
最後更新於 8月 16, 2026 (00:17 UTC)。
369369

370370
<a href="/bugs.html">發現 bug</a>
371371

pr-preview/pr-1231/c-api/allocation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ <h3>導航</h3>
577577
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
578578
<br>
579579
<br>
580-
最後更新於 8月 15, 2026 (00:17 UTC)。
580+
最後更新於 8月 16, 2026 (00:17 UTC)。
581581

582582
<a href="/bugs.html">發現 bug</a>
583583

pr-preview/pr-1231/c-api/apiabiversion.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ <h3>導航</h3>
514514
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
515515
<br>
516516
<br>
517-
最後更新於 8月 15, 2026 (00:17 UTC)。
517+
最後更新於 8月 16, 2026 (00:17 UTC)。
518518

519519
<a href="/bugs.html">發現 bug</a>
520520

pr-preview/pr-1231/c-api/arg.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ <h3>導航</h3>
10011001
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
10021002
<br>
10031003
<br>
1004-
最後更新於 8月 15, 2026 (00:17 UTC)。
1004+
最後更新於 8月 16, 2026 (00:17 UTC)。
10051005

10061006
<a href="/bugs.html">發現 bug</a>
10071007

pr-preview/pr-1231/c-api/bool.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ <h3>導航</h3>
376376
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
377377
<br>
378378
<br>
379-
最後更新於 8月 15, 2026 (00:17 UTC)。
379+
最後更新於 8月 16, 2026 (00:17 UTC)。
380380

381381
<a href="/bugs.html">發現 bug</a>
382382

pr-preview/pr-1231/c-api/buffer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ <h3>導航</h3>
10671067
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
10681068
<br>
10691069
<br>
1070-
最後更新於 8月 15, 2026 (00:17 UTC)。
1070+
最後更新於 8月 16, 2026 (00:17 UTC)。
10711071

10721072
<a href="/bugs.html">發現 bug</a>
10731073

pr-preview/pr-1231/c-api/bytearray.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ <h3>導航</h3>
457457
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
458458
<br>
459459
<br>
460-
最後更新於 8月 15, 2026 (00:17 UTC)。
460+
最後更新於 8月 16, 2026 (00:17 UTC)。
461461

462462
<a href="/bugs.html">發現 bug</a>
463463

0 commit comments

Comments
 (0)