Jump to content

Nautical bell: Difference between revisions

Line 809:
en.wikipedia.org/wiki/Ship%27s_bell#Simpler_system.
Note the traditional time zone was determined by local sun position
and so should be close to local time ratherwithout thandaylight GMTsavings time.
"""
function nauticalbells(dt::DateTime)
Line 828:
 
function nauticalbelltask()
untilnextbell = ceil(now(), Dates.Minute(30)) - now()
# parse for milliseconds til next hour, start timer with that delay
delay = untilnexthouruntilnextbell.value / 1000
untilnexthour = now() - DateTime(match(r"^([^:]+)", string(now())).captures[1])
delay = untilnexthour.value / 1000
println("Nautical bell task starting -- next bell in $delay seconds.")
# The timer wakes its task every half hour. May drift very slightly so restart yearly.
Line 837 ⟶ 836:
wait(timer)
gong = nauticalbells(now())
@async(println("Nautical bell gong strikes $gong!")) # or do hardware dependent audible tones
end
end
4,105

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.