Nautical bell: Difference between revisions
Content added Content deleted
m (→{{header|D}}) |
(Small changes in D entry) |
||
Line 34: | Line 34: | ||
if (next.minute == time.minute && |
if (next.minute == time.minute && |
||
next.hour == time.hour) { |
next.hour == time.hour) { |
||
immutable bells = (numBells == 1) ? "bell" : "bells"; |
|||
writefln("%s : %d %s ", time, numBells, bells); |
writefln("%s : %d %s ", time, numBells, bells); |
||
setNextBellTime(); |
setNextBellTime(); |
||
} |
} |
||
sleep(dur!"msecs"(100)); |
sleep(dur!"msecs"(100)); |
||
yield(); |
yield(); |
||
} |
} |
||
} |
} |
||
void stop() { |
void stop() pure nothrow { |
||
this.stopped = true; |
this.stopped = true; |
||
} |
} |
||
Line 50: | Line 50: | ||
void main() { |
void main() { |
||
auto bells = new NauticalBell(); |
auto bells = new NauticalBell(); |
||
//bells.isDaemon(true); |
|||
bells.start(); |
bells.start(); |
||
}</lang> |
}</lang> |