Skip to content

Commit 3b26363

Browse files
committed
alarm clock example
1 parent ceac465 commit 3b26363

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,23 @@ julia-0.7> laptimer()
7878
1 327.074715234s: 5 minutes, 27 seconds, 74 milliseconds
7979
```
8080

81+
- make an alarmclock function
82+
```julia
83+
function alarmclock(hours, minutes, seconds)
84+
tick()
85+
while true
86+
sleep(5)
87+
if peektimer() > hours * 60 * 60 + minutes * 60 + seconds
88+
println("time's up")
89+
tock()
90+
break
91+
end
92+
end
93+
end
94+
95+
alarmclock(0, 30, 0)
96+
```
97+
8198
You should *not* use this package to:
8299

83100
- measure performance of Julia code

0 commit comments

Comments
 (0)