Code für Teil21 Interrupts
This commit is contained in:
19
teil21/alarm.py
Executable file
19
teil21/alarm.py
Executable file
@@ -0,0 +1,19 @@
|
||||
#! /usr/bin/python3
|
||||
# encoding:utf-8
|
||||
|
||||
import signal
|
||||
import time
|
||||
|
||||
|
||||
def handle_alarm(signum, frame):
|
||||
print(f'Alarm ausgelöst bei {time.ctime()}')
|
||||
|
||||
signal.signal(signal.SIGALRM,handle_alarm)
|
||||
|
||||
signal.alarm(3)
|
||||
|
||||
print(f'aktuelle Zeit Start: {time.ctime()}')
|
||||
|
||||
time.sleep(13)
|
||||
print(f'aktuelle Zeit Ende: {time.ctime()}')
|
||||
|
Reference in New Issue
Block a user