Nautical bell: Difference between revisions

m
whitespace/tidy up
m (wiki syntax)
m (whitespace/tidy up)
Line 1:
{{draft task}}
[[Category: Date and time]]
 
The task is to write a small program that emulates a [http[wp://en.wikipedia.org/wiki/Ship%27s_bell's bell#Timing_of_duty_periods |nautical bell]] producing a ringing bell pattern at certain times throughout the day.
The bell timing should be in accordance with [http[wp://en.wikipedia.org/wiki/GMT |Greenwich Mean Time]], unless locale dictates otherwise.
 
The bell timing should be in accordance with [http://en.wikipedia.org/wiki/GMT Greenwich Mean Time], unless locale dictates otherwise.
 
It is permissible for the program to [[Run as a daemon|daemonize]], or to slave off a scheduler, and it is permissible to use alternative notification methods (such as producing a written notice "Two Bells Gone"), if these are more usual for the system type.
 
[[Category: Date and time]]
 
=={{header|D}}==
This code uses local time instead of Greenwich Mean Time.
 
This code uses local time instead of Greenwich Mean Time.
 
<lang d>import std.stdio, core.thread, std.datetime;
 
Line 70 ⟶ 65:
=={{header|REXX}}==
The local time is used instead of Greenwich mean time.
 
<br><br>If any arguments are specified, that text is used as a prefix to the times shown (once a minute).
<br>Also, the number of bells sounded are shown (if any arguments are specified).
<br>If &nbsp; no arguments are specified, no times are shown.
<br>In all cases, the PC speaker is used to sound the bells &nbsp; (albeit a poorly sounded bell).
<br><br>This REXX program makes use of &nbsp; '''DELAY''' &nbsp; BIF which delays (sleeps) for a specified amount of seconds.
 
<br>Some REXXes doen't have a &nbsp; '''DELAY''' &nbsp; BIF, so one is included here ──► [[DELAY.REX]].
<br><br>This REXX program makes use of &nbsp;<code>DELAY</code>, BIF which delays (sleeps) for a specified amount of seconds (some REXXes doen'''SOUND'''t &nbsp;have a <code>DELAY</code> BIF, so one is included [[DELAY.REX|here]]), and <code>SOUND</code> BIF, which produces sounds via the PC speaker. (some REXXes doen't have a <code>SOUND</code> BIF, so one is included [[SOUND.REX|here]]).
<br>Some REXXes doen't have a &nbsp; '''SOUND''' &nbsp; BIF, so one is included here ──► [[SOUND.REX]].
<lang rexx>/*REXX pgm sounds "bells" (using PC speaker) when running (perpetually).*/
echo= arg()\==0 /*echo time & bells if any args. */
Line 101 ⟶ 95:
call delay 60 /*ensure don't re-peel.*/
end /*forever*/
halt: /*stick a fork in it, we're done.*/</lang>
</lang>
'''output''' when using the input of: <tt> the time is: </tt>
<pre>
<pre style="overflow:scroll">
the time is: 1:48pm
the time is: 1:49pm
Anonymous user