Skip to content

Commit 816f894

Browse files
committed
/howto/timer.po -> translated for the first time
1 parent 362b0d6 commit 816f894

1 file changed

Lines changed: 234 additions & 12 deletions

File tree

‎howto/timerfd.po‎

Lines changed: 234 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
# SOME DESCRIPTIVE TITLE.
1+
# German translation of the Python documentation.
22
# Copyright (C) 2001 Python Software Foundation
33
# This file is distributed under the same license as the Python package.
4-
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
54
#
65
# Translators:
76
# python-doc bot, 2025
7+
# Swen Bachmann, 2026
88
#
9-
#, fuzzy
109
msgid ""
1110
msgstr ""
1211
"Project-Id-Version: Python 3.15\n"
1312
"Report-Msgid-Bugs-To: \n"
1413
"POT-Creation-Date: 2026-08-22 12:07+0200\n"
15-
"PO-Revision-Date: 2025-09-16 00:00+0000\n"
14+
"PO-Revision-Date: 2026-10-15 06:00+0200\n"
1615
"Last-Translator: python-doc bot, 2025\n"
17-
"Language-Team: German (https://app.transifex.com/python-doc/teams/5390/de/)\n"
16+
"Language-Team: German (https://github.com/python/python-docs-de)\n"
1817
"Language: de\n"
1918
"MIME-Version: 1.0\n"
2019
"Content-Type: text/plain; charset=UTF-8\n"
@@ -23,30 +22,34 @@ msgstr ""
2322

2423
#: ../../howto/timerfd.rst:5
2524
msgid "timer file descriptor HOWTO"
26-
msgstr ""
25+
msgstr "HOWTO zum Timer-Dateideskriptor"
2726

2827
#: ../../howto/timerfd.rst:0
2928
msgid "Release"
3029
msgstr "Release"
3130

3231
#: ../../howto/timerfd.rst:7
3332
msgid "1.13"
34-
msgstr ""
33+
msgstr "1.13"
3534

3635
#: ../../howto/timerfd.rst:9
3736
msgid ""
3837
"This HOWTO discusses Python's support for the linux timer file descriptor."
3938
msgstr ""
39+
"Dieses HOWTO behandelt die Unterstützung von Linux-Timer-Dateideskriptoren "
40+
"in Python."
4041

4142
#: ../../howto/timerfd.rst:13
4243
msgid "Examples"
43-
msgstr ""
44+
msgstr "Beispiele"
4445

4546
#: ../../howto/timerfd.rst:15
4647
msgid ""
4748
"The following example shows how to use a timer file descriptor to execute a "
4849
"function twice a second:"
4950
msgstr ""
51+
"Das folgende Beispiel zeigt, wie sich mit einem Timer-Dateideskriptor eine "
52+
"Funktion zweimal pro Sekunde ausführen lässt:"
5053

5154
#: ../../howto/timerfd.rst:18
5255
msgid ""
@@ -70,19 +73,45 @@ msgid ""
7073
" # Remember to close the timer file descriptor!\n"
7174
" os.close(fd)"
7275
msgstr ""
76+
"# Practical scripts should use really use a non-blocking timer,\n"
77+
"# we use a blocking timer here for simplicity.\n"
78+
"import os, time\n"
79+
"\n"
80+
"# Create the timer file descriptor\n"
81+
"fd = os.timerfd_create(time.CLOCK_REALTIME)\n"
82+
"\n"
83+
"# Start the timer in 1 second, with an interval of half a second\n"
84+
"os.timerfd_settime(fd, initial=1, interval=0.5)\n"
85+
"\n"
86+
"try:\n"
87+
" # Process timer events four times.\n"
88+
" for _ in range(4):\n"
89+
" # read() will block until the timer expires\n"
90+
" _ = os.read(fd, 8)\n"
91+
" print(\"Timer expired\")\n"
92+
"finally:\n"
93+
" # Remember to close the timer file descriptor!\n"
94+
" os.close(fd)"
7395

7496
#: ../../howto/timerfd.rst:40
7597
msgid ""
7698
"To avoid the precision loss caused by the :class:`float` type, timer file "
7799
"descriptors allow specifying initial expiration and interval in integer "
78100
"nanoseconds with ``_ns`` variants of the functions."
79101
msgstr ""
102+
"Um den Genauigkeitsverlust durch den Typ :class:`float` zu vermeiden, "
103+
"erlauben Timer-Dateideskriptoren die Angabe des ersten Ablaufs und des "
104+
"Intervalls in ganzzahligen Nanosekunden – über die ``_ns``-Varianten der "
105+
"Funktionen."
80106

81107
#: ../../howto/timerfd.rst:44
82108
msgid ""
83109
"This example shows how :func:`~select.epoll` can be used with timer file "
84110
"descriptors to wait until the file descriptor is ready for reading:"
85111
msgstr ""
112+
"Dieses Beispiel zeigt, wie sich :func:`~select.epoll` mit Timer-"
113+
"Dateideskriptoren verwenden lässt, um zu warten, bis der Dateideskriptor zum "
114+
"Lesen bereit ist:"
86115

87116
#: ../../howto/timerfd.rst:47
88117
msgid ""
@@ -189,8 +218,8 @@ msgid ""
189218
" conn = None\n"
190219
" elif fd in fds:\n"
191220
" print(f\"Reading timer {fd}\")\n"
192-
" count = int.from_bytes(os.read(fd, 8), byteorder=sys."
193-
"byteorder)\n"
221+
" count = int.from_bytes(os.read(fd, 8), "
222+
"byteorder=sys.byteorder)\n"
194223
" print(f\"Timer {fds.index(fd) + 1} expired {count} "
195224
"times\")\n"
196225
" else:\n"
@@ -201,12 +230,129 @@ msgid ""
201230
" os.close(fd)\n"
202231
" ep.close()"
203232
msgstr ""
233+
"import os, time, select, socket, sys\n"
234+
"\n"
235+
"# Create an epoll object\n"
236+
"ep = select.epoll()\n"
237+
"\n"
238+
"# In this example, use loopback address to send \"stop\" command to the "
239+
"server.\n"
240+
"#\n"
241+
"# $ telnet 127.0.0.1 1234\n"
242+
"# Trying 127.0.0.1...\n"
243+
"# Connected to 127.0.0.1.\n"
244+
"# Escape character is '^]'.\n"
245+
"# stop\n"
246+
"# Connection closed by foreign host.\n"
247+
"#\n"
248+
"sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n"
249+
"sock.bind((\"127.0.0.1\", 1234))\n"
250+
"sock.setblocking(False)\n"
251+
"sock.listen(1)\n"
252+
"ep.register(sock, select.EPOLLIN)\n"
253+
"\n"
254+
"# Create timer file descriptors in non-blocking mode.\n"
255+
"num = 3\n"
256+
"fds = []\n"
257+
"for _ in range(num):\n"
258+
" fd = os.timerfd_create(time.CLOCK_REALTIME, flags=os.TFD_NONBLOCK)\n"
259+
" fds.append(fd)\n"
260+
" # Register the timer file descriptor for read events\n"
261+
" ep.register(fd, select.EPOLLIN)\n"
262+
"\n"
263+
"# Start the timer with os.timerfd_settime_ns() in nanoseconds.\n"
264+
"# Timer 1 fires every 0.25 seconds; timer 2 every 0.5 seconds; etc\n"
265+
"for i, fd in enumerate(fds, start=1):\n"
266+
" one_sec_in_nsec = 10**9\n"
267+
" i = i * one_sec_in_nsec\n"
268+
" os.timerfd_settime_ns(fd, initial=i//4, interval=i//4)\n"
269+
"\n"
270+
"timeout = 3\n"
271+
"try:\n"
272+
" conn = None\n"
273+
" is_active = True\n"
274+
" while is_active:\n"
275+
" # Wait for the timer to expire for 3 seconds.\n"
276+
" # epoll.poll() returns a list of (fd, event) pairs.\n"
277+
" # fd is a file descriptor.\n"
278+
" # sock and conn[=returned value of socket.accept()] are socket "
279+
"objects, not file descriptors.\n"
280+
" # So use sock.fileno() and conn.fileno() to get the file "
281+
"descriptors.\n"
282+
" events = ep.poll(timeout)\n"
283+
"\n"
284+
" # If more than one timer file descriptors are ready for reading at "
285+
"once,\n"
286+
" # epoll.poll() returns a list of (fd, event) pairs.\n"
287+
" #\n"
288+
" # In this example settings,\n"
289+
" # 1st timer fires every 0.25 seconds in 0.25 seconds. (0.25, 0.5, "
290+
"0.75, 1.0, ...)\n"
291+
" # 2nd timer every 0.5 seconds in 0.5 seconds. (0.5, 1.0, 1.5, "
292+
"2.0, ...)\n"
293+
" # 3rd timer every 0.75 seconds in 0.75 seconds. (0.75, 1.5, 2.25, "
294+
"3.0, ...)\n"
295+
" #\n"
296+
" # In 0.25 seconds, only 1st timer fires.\n"
297+
" # In 0.5 seconds, 1st timer and 2nd timer fires at once.\n"
298+
" # In 0.75 seconds, 1st timer and 3rd timer fires at once.\n"
299+
" # In 1.5 seconds, 1st timer, 2nd timer and 3rd timer fires at "
300+
"once.\n"
301+
" #\n"
302+
" # If a timer file descriptor is signaled more than once since\n"
303+
" # the last os.read() call, os.read() returns the number of signaled\n"
304+
" # as host order of class bytes.\n"
305+
" print(f\"Signaled events={events}\")\n"
306+
" for fd, event in events:\n"
307+
" if event & select.EPOLLIN:\n"
308+
" if fd == sock.fileno():\n"
309+
" # Check if there is a connection request.\n"
310+
" print(f\"Accepting connection {fd}\")\n"
311+
" conn, addr = sock.accept()\n"
312+
" conn.setblocking(False)\n"
313+
" print(f\"Accepted connection {conn} from {addr}\")\n"
314+
" ep.register(conn, select.EPOLLIN)\n"
315+
" elif conn and fd == conn.fileno():\n"
316+
" # Check if there is data to read.\n"
317+
" print(f\"Reading data {fd}\")\n"
318+
" data = conn.recv(1024)\n"
319+
" if data:\n"
320+
" # You should catch UnicodeDecodeError exception for "
321+
"safety.\n"
322+
" cmd = data.decode()\n"
323+
" if cmd.startswith(\"stop\"):\n"
324+
" print(f\"Stopping server\")\n"
325+
" is_active = False\n"
326+
" else:\n"
327+
" print(f\"Unknown command: {cmd}\")\n"
328+
" else:\n"
329+
" # No more data, close connection\n"
330+
" print(f\"Closing connection {fd}\")\n"
331+
" ep.unregister(conn)\n"
332+
" conn.close()\n"
333+
" conn = None\n"
334+
" elif fd in fds:\n"
335+
" print(f\"Reading timer {fd}\")\n"
336+
" count = int.from_bytes(os.read(fd, 8), "
337+
"byteorder=sys.byteorder)\n"
338+
" print(f\"Timer {fds.index(fd) + 1} expired {count} "
339+
"times\")\n"
340+
" else:\n"
341+
" print(f\"Unknown file descriptor {fd}\")\n"
342+
"finally:\n"
343+
" for fd in fds:\n"
344+
" ep.unregister(fd)\n"
345+
" os.close(fd)\n"
346+
" ep.close()"
204347

205348
#: ../../howto/timerfd.rst:153
206349
msgid ""
207350
"This example shows how :func:`~select.select` can be used with timer file "
208351
"descriptors to wait until the file descriptor is ready for reading:"
209352
msgstr ""
353+
"Dieses Beispiel zeigt, wie sich :func:`~select.select` mit Timer-"
354+
"Dateideskriptoren verwenden lässt, um zu warten, bis der Dateideskriptor zum "
355+
"Lesen bereit ist:"
210356

211357
#: ../../howto/timerfd.rst:156
212358
msgid ""
@@ -276,8 +422,8 @@ msgid ""
276422
" conn = None\n"
277423
" elif fd in fds:\n"
278424
" print(f\"Reading timer {fd}\")\n"
279-
" count = int.from_bytes(os.read(fd, 8), byteorder=sys."
280-
"byteorder)\n"
425+
" count = int.from_bytes(os.read(fd, 8), "
426+
"byteorder=sys.byteorder)\n"
281427
" print(f\"Timer {fds.index(fd) + 1} expired {count} times\")\n"
282428
" else:\n"
283429
" print(f\"Unknown file descriptor {fd}\")\n"
@@ -287,3 +433,79 @@ msgid ""
287433
" sock.close()\n"
288434
" sock = None"
289435
msgstr ""
436+
"import os, time, select, socket, sys\n"
437+
"\n"
438+
"# In this example, use loopback address to send \"stop\" command to the "
439+
"server.\n"
440+
"#\n"
441+
"# $ telnet 127.0.0.1 1234\n"
442+
"# Trying 127.0.0.1...\n"
443+
"# Connected to 127.0.0.1.\n"
444+
"# Escape character is '^]'.\n"
445+
"# stop\n"
446+
"# Connection closed by foreign host.\n"
447+
"#\n"
448+
"sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n"
449+
"sock.bind((\"127.0.0.1\", 1234))\n"
450+
"sock.setblocking(False)\n"
451+
"sock.listen(1)\n"
452+
"\n"
453+
"# Create timer file descriptors in non-blocking mode.\n"
454+
"num = 3\n"
455+
"fds = [os.timerfd_create(time.CLOCK_REALTIME, flags=os.TFD_NONBLOCK)\n"
456+
" for _ in range(num)]\n"
457+
"select_fds = fds + [sock]\n"
458+
"\n"
459+
"# Start the timers with os.timerfd_settime() in seconds.\n"
460+
"# Timer 1 fires every 0.25 seconds; timer 2 every 0.5 seconds; etc\n"
461+
"for i, fd in enumerate(fds, start=1):\n"
462+
" os.timerfd_settime(fd, initial=i/4, interval=i/4)\n"
463+
"\n"
464+
"timeout = 3\n"
465+
"try:\n"
466+
" conn = None\n"
467+
" is_active = True\n"
468+
" while is_active:\n"
469+
" # Wait for the timer to expire for 3 seconds.\n"
470+
" # select.select() returns a list of file descriptors or objects.\n"
471+
" rfd, wfd, xfd = select.select(select_fds, select_fds, select_fds, "
472+
"timeout)\n"
473+
" for fd in rfd:\n"
474+
" if fd == sock:\n"
475+
" # Check if there is a connection request.\n"
476+
" print(f\"Accepting connection {fd}\")\n"
477+
" conn, addr = sock.accept()\n"
478+
" conn.setblocking(False)\n"
479+
" print(f\"Accepted connection {conn} from {addr}\")\n"
480+
" select_fds.append(conn)\n"
481+
" elif conn and fd == conn:\n"
482+
" # Check if there is data to read.\n"
483+
" print(f\"Reading data {fd}\")\n"
484+
" data = conn.recv(1024)\n"
485+
" if data:\n"
486+
" # You should catch UnicodeDecodeError exception for "
487+
"safety.\n"
488+
" cmd = data.decode()\n"
489+
" if cmd.startswith(\"stop\"):\n"
490+
" print(f\"Stopping server\")\n"
491+
" is_active = False\n"
492+
" else:\n"
493+
" print(f\"Unknown command: {cmd}\")\n"
494+
" else:\n"
495+
" # No more data, close connection\n"
496+
" print(f\"Closing connection {fd}\")\n"
497+
" select_fds.remove(conn)\n"
498+
" conn.close()\n"
499+
" conn = None\n"
500+
" elif fd in fds:\n"
501+
" print(f\"Reading timer {fd}\")\n"
502+
" count = int.from_bytes(os.read(fd, 8), "
503+
"byteorder=sys.byteorder)\n"
504+
" print(f\"Timer {fds.index(fd) + 1} expired {count} times\")\n"
505+
" else:\n"
506+
" print(f\"Unknown file descriptor {fd}\")\n"
507+
"finally:\n"
508+
" for fd in fds:\n"
509+
" os.close(fd)\n"
510+
" sock.close()\n"
511+
" sock = None"

0 commit comments

Comments
 (0)