18 lines
338 B
Ruby
18 lines
338 B
Ruby
#!/usr/bin/ruby -w
|
|
|
|
nsec=0
|
|
|
|
trap("SIGINT" ){ #attention a la place de la parenthese ouvrante
|
|
puts "\n"+nsec.to_s + " secondes ecoulees \n"
|
|
}
|
|
|
|
|
|
trap("SIGQUIT" ){ #attention a la place de la parenthese ouvrante
|
|
puts "\nFin du chronomètre "+nsec.to_s + " secondes ecoulees \n"
|
|
exit
|
|
}
|
|
|
|
while true
|
|
sleep 1
|
|
nsec = nsec + 1
|
|
end |