Skip to content

Instantly share code, notes, and snippets.

@FeepingCreature
Created May 22, 2012 11:50
Show Gist options
  • Save FeepingCreature/2768572 to your computer and use it in GitHub Desktop.
Save FeepingCreature/2768572 to your computer and use it in GitHub Desktop.
auto once-per(float t) {
auto lastrun = sec();
return new \(void delegate() task) {
auto sec = sec();
if (sec - lastrun > t) {
lastrun = sec;
task();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment