Timer
Chris
wendlec at tcd.ie
Mon Feb 17 03:36:48 PST 2014
On Monday, 17 February 2014 at 11:20:05 UTC, Chris wrote:
> On Monday, 17 February 2014 at 11:11:06 UTC, simendsjo wrote:
>> On Monday, 17 February 2014 at 11:08:16 UTC, Chris wrote:
>>> The D way of implementing a timer? I need to (automatically)
>>> execute a function that performs a clean up, say every hour.
>>>
>>> if (file.older than 1 hour) {
>>> remove;
>>> }
>>
>> Vibe.d can be used for this to get an OS agnostic solution.
>> Haven't used it myself, but this function seems to be what you
>> are looking for:
>> https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/core/core.d#L342
>
> Great, it's for a vibe.d project anyway, it might do the trick.
>
> Out of interest, if there's a phobos way, let me know.
This works (in vibe.d):
auto timer = setTimer(1.seconds, toDelegate(&clearDir), true);
More information about the Digitalmars-d-learn
mailing list