Nautical bell: Difference between revisions
→{{header|Julia}}
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
"""
function nauticalbells(dt::DateTime)
Line 828:
function nauticalbelltask()
untilnextbell = ceil(now(), Dates.Minute(30)) - now()
▲ 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
end
end
|