output_plugin: add method delay()

This method is used to reduce the delay of commands issued to the
shout plugin.
This commit is contained in:
Max Kellermann
2010-11-05 08:02:38 +01:00
parent ad430c6617
commit 2dc6ed7b3a
3 changed files with 51 additions and 3 deletions

View File

@@ -74,12 +74,12 @@ void timer_add(Timer *timer, int size)
unsigned
timer_delay(const Timer *timer)
{
int64_t delay = timer->time - now();
int64_t delay = (timer->time - now()) / 1000;
if (delay < 0)
return 0;
if (delay > 1000 * 1000 * 1000)
return 1000 * 1000;
if (delay > G_MAXINT)
delay = G_MAXINT;
return delay / 1000;
}