diff --git a/tests/.gitignore b/tests/.gitignore
index 0ace365..1cb28c9 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -22,6 +22,8 @@
 heavythread
 heavywq
 tabletest
+test-timer-correctness
+test-timer-performance
 testbgpcap
 testbgpmpath
 testbgpmpattr
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8707fe7..8a086d0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -28,7 +28,7 @@
 
 check_PROGRAMS = testsig testsegv testbuffer testmemory heavy heavywq heavythread \
 		testprivs teststream testchecksum tabletest testnexthopiter \
-		testcommands \
+		testcommands test-timer-correctness test-timer-performance \
 		$(TESTS_BGPD)
 
 ../vtysh/vtysh_cmd.c:
@@ -63,6 +63,8 @@
 tabletest_SOURCES = table_test.c
 testnexthopiter_SOURCES = test-nexthop-iter.c prng.c
 testcommands_SOURCES = test-commands-defun.c test-commands.c prng.c
+test_timer_correctness_SOURCES = test-timer-correctness.c prng.c
+test_timer_performance_SOURCES = test-timer-performance.c prng.c
 
 testsig_LDADD = ../lib/libzebra.la @LIBCAP@
 testsegv_LDADD = ../lib/libzebra.la @LIBCAP@
@@ -82,3 +84,5 @@
 tabletest_LDADD = ../lib/libzebra.la @LIBCAP@ -lm
 testnexthopiter_LDADD = ../lib/libzebra.la @LIBCAP@
 testcommands_LDADD = ../lib/libzebra.la @LIBCAP@
+test_timer_correctness_LDADD = ../lib/libzebra.la @LIBCAP@
+test_timer_performance_LDADD = ../lib/libzebra.la @LIBCAP@
diff --git a/tests/libzebra.tests/Makefile.am b/tests/libzebra.tests/Makefile.am
index a1ffea3..819cce2 100644
--- a/tests/libzebra.tests/Makefile.am
+++ b/tests/libzebra.tests/Makefile.am
@@ -1,4 +1,5 @@
 EXTRA_DIST = \
 	tabletest.exp \
+	test-timer-correctness.exp \
 	testcommands.exp \
 	testnexthopiter.exp
diff --git a/tests/libzebra.tests/test-timer-correctness.exp b/tests/libzebra.tests/test-timer-correctness.exp
new file mode 100644
index 0000000..83531c7
--- /dev/null
+++ b/tests/libzebra.tests/test-timer-correctness.exp
@@ -0,0 +1,7 @@
+set timeout 10
+set testprefix "test-timer-correctness"
+set aborted 0
+
+spawn "./test-timer-correctness"
+
+onesimple "" "Expected output and actual output match."
diff --git a/tests/test-timer-correctness.c b/tests/test-timer-correctness.c
new file mode 100644
index 0000000..94c8f1d
--- /dev/null
+++ b/tests/test-timer-correctness.c
@@ -0,0 +1,194 @@
+/*
+ * Test program to verify that scheduled timers are executed in the
+ * correct order.
+ *
+ * Copyright (C) 2013 by Open Source Routing.
+ * Copyright (C) 2013 by Internet Systems Consortium, Inc. ("ISC")
+ *
+ * This file is part of Quagga
+ *
+ * Quagga is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * Quagga is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Quagga; see the file COPYING.  If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <zebra.h>
+
+#include "memory.h"
+#include "pqueue.h"
+#include "prng.h"
+#include "thread.h"
+
+#define SCHEDULE_TIMERS 800
+#define REMOVE_TIMERS   200
+
+#define TIMESTR_LEN strlen("4294967296.999999")
+
+struct thread_master *master;
+
+static size_t log_buf_len;
+static size_t log_buf_pos;
+static char *log_buf;
+
+static size_t expected_buf_len;
+static size_t expected_buf_pos;
+static char *expected_buf;
+
+static struct prng *prng;
+
+static struct thread **timers;
+
+static int timers_pending;
+
+static void terminate_test(void)
+{
+  int exit_code;
+
+  if (strcmp(log_buf, expected_buf))
+    {
+      fprintf(stderr, "Expected output and received output differ.\n");
+      fprintf(stderr, "---Expected output: ---\n%s", expected_buf);
+      fprintf(stderr, "---Actual output: ---\n%s", log_buf);
+      exit_code = 1;
+    }
+  else
+    {
+      printf("Expected output and actual output match.\n");
+      exit_code = 0;
+    }
+
+  thread_master_free(master);
+  XFREE(MTYPE_TMP, log_buf);
+  XFREE(MTYPE_TMP, expected_buf);
+  prng_free(prng);
+  XFREE(MTYPE_TMP, timers);
+
+  exit(exit_code);
+}
+
+static int timer_func(struct thread *thread)
+{
+  int rv;
+
+  rv = snprintf(log_buf + log_buf_pos, log_buf_len - log_buf_pos,
+                "%s\n", (char*)thread->arg);
+  assert(rv >= 0);
+  log_buf_pos += rv;
+  assert(log_buf_pos < log_buf_len);
+  XFREE(MTYPE_TMP, thread->arg);
+
+  timers_pending--;
+  if (!timers_pending)
+    terminate_test();
+
+  return 0;
+}
+
+static int cmp_timeval(const void* a, const void *b)
+{
+  const struct timeval *ta = *(struct timeval * const *)a;
+  const struct timeval *tb = *(struct timeval * const *)b;
+
+  if (timercmp(ta, tb, <))
+    return -1;
+  if (timercmp(ta, tb, >))
+    return 1;
+  return 0;
+}
+
+int main(int argc, char **argv)
+{
+  int i, j;
+  struct thread t;
+  struct timeval **alarms;
+
+  master = thread_master_create();
+
+  log_buf_len = SCHEDULE_TIMERS * (TIMESTR_LEN + 1) + 1;
+  log_buf_pos = 0;
+  log_buf = XMALLOC(MTYPE_TMP, log_buf_len);
+
+  expected_buf_len = SCHEDULE_TIMERS * (TIMESTR_LEN + 1) + 1;
+  expected_buf_pos = 0;
+  expected_buf = XMALLOC(MTYPE_TMP, expected_buf_len);
+
+  prng = prng_new(0);
+
+  timers = XMALLOC(MTYPE_TMP, SCHEDULE_TIMERS * sizeof(*timers));
+
+  for (i = 0; i < SCHEDULE_TIMERS; i++)
+    {
+      long interval_msec;
+      int ret;
+      char *arg;
+
+      /* Schedule timers to expire in 0..5 seconds */
+      interval_msec = prng_rand(prng) % 5000;
+      arg = XMALLOC(MTYPE_TMP, TIMESTR_LEN + 1);
+      timers[i] = thread_add_timer_msec(master, timer_func, arg, interval_msec);
+      ret = snprintf(arg, TIMESTR_LEN + 1, "%ld.%06ld",
+                     timers[i]->u.sands.tv_sec, timers[i]->u.sands.tv_usec);
+      assert(ret > 0);
+      assert((size_t)ret < TIMESTR_LEN + 1);
+      timers_pending++;
+    }
+
+  for (i = 0; i < REMOVE_TIMERS; i++)
+    {
+      int index;
+
+      index = prng_rand(prng) % SCHEDULE_TIMERS;
+      if (!timers[index])
+        continue;
+
+      XFREE(MTYPE_TMP, timers[index]->arg);
+      thread_cancel(timers[index]);
+      timers[index] = NULL;
+      timers_pending--;
+    }
+
+  /* We create an array of pointers to the alarm times and sort
+   * that array. That sorted array is used to generate a string
+   * representing the expected "output" of the timers when they
+   * are run. */
+  j = 0;
+  alarms = XMALLOC(MTYPE_TMP, timers_pending * sizeof(*alarms));
+  for (i = 0; i < SCHEDULE_TIMERS; i++)
+    {
+      if (!timers[i])
+        continue;
+      alarms[j++] = &timers[i]->u.sands;
+    }
+  qsort(alarms, j, sizeof(*alarms), cmp_timeval);
+  for (i = 0; i < j; i++)
+    {
+      int ret;
+
+      ret = snprintf(expected_buf + expected_buf_pos,
+                     expected_buf_len - expected_buf_pos,
+                     "%ld.%06ld\n", alarms[i]->tv_sec, alarms[i]->tv_usec);
+      assert(ret > 0);
+      expected_buf_pos += ret;
+      assert(expected_buf_pos < expected_buf_len);
+    }
+  XFREE(MTYPE_TMP, alarms);
+
+  while (thread_fetch(master, &t))
+    thread_call(&t);
+
+  return 0;
+}
diff --git a/tests/test-timer-performance.c b/tests/test-timer-performance.c
new file mode 100644
index 0000000..a529a5c
--- /dev/null
+++ b/tests/test-timer-performance.c
@@ -0,0 +1,104 @@
+/*
+ * Test program which measures the time it takes to schedule and
+ * remove timers.
+ *
+ * Copyright (C) 2013 by Open Source Routing.
+ * Copyright (C) 2013 by Internet Systems Consortium, Inc. ("ISC")
+ *
+ * This file is part of Quagga
+ *
+ * Quagga is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * Quagga is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Quagga; see the file COPYING.  If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+#include <stdio.h>
+#include <unistd.h>
+
+#include <zebra.h>
+
+#include "thread.h"
+#include "pqueue.h"
+#include "prng.h"
+
+#define SCHEDULE_TIMERS 1000000
+#define REMOVE_TIMERS    500000
+
+struct thread_master *master;
+
+static int dummy_func(struct thread *thread)
+{
+  return 0;
+}
+
+int main(int argc, char **argv)
+{
+  struct prng *prng;
+  int i;
+  struct thread **timers;
+  struct timeval tv_start, tv_lap, tv_stop;
+  unsigned long t_schedule, t_remove;
+
+  master = thread_master_create();
+  prng = prng_new(0);
+  timers = calloc(SCHEDULE_TIMERS, sizeof(*timers));
+
+  /* create thread structures so they won't be allocated during the
+   * time measurement */
+  for (i = 0; i < SCHEDULE_TIMERS; i++)
+    timers[i] = thread_add_timer_msec(master, dummy_func, NULL, 0);
+  for (i = 0; i < SCHEDULE_TIMERS; i++)
+    thread_cancel(timers[i]);
+
+  quagga_gettime(QUAGGA_CLK_MONOTONIC, &tv_start);
+
+  for (i = 0; i < SCHEDULE_TIMERS; i++)
+    {
+      long interval_msec;
+
+      interval_msec = prng_rand(prng) % (100 * SCHEDULE_TIMERS);
+      timers[i] = thread_add_timer_msec(master, dummy_func,
+                                        NULL, interval_msec);
+    }
+
+  quagga_gettime(QUAGGA_CLK_MONOTONIC, &tv_lap);
+
+  for (i = 0; i < REMOVE_TIMERS; i++)
+    {
+      int index;
+
+      index = prng_rand(prng) % SCHEDULE_TIMERS;
+      if (timers[index])
+        thread_cancel(timers[index]);
+      timers[index] = NULL;
+    }
+
+  quagga_gettime(QUAGGA_CLK_MONOTONIC, &tv_stop);
+
+  t_schedule = 1000 * (tv_lap.tv_sec - tv_start.tv_sec);
+  t_schedule += (tv_lap.tv_usec - tv_start.tv_usec) / 1000;
+
+  t_remove = 1000 * (tv_stop.tv_sec - tv_lap.tv_sec);
+  t_remove += (tv_stop.tv_usec - tv_lap.tv_usec) / 1000;
+
+  printf("Scheduling %d random timers took %ld.%03ld seconds.\n",
+         SCHEDULE_TIMERS, t_schedule/1000, t_schedule%1000);
+  printf("Removing %d random timers took %ld.%03ld seconds.\n",
+         REMOVE_TIMERS, t_remove/1000, t_remove%1000);
+  fflush(stdout);
+
+  free(timers);
+  thread_master_free(master);
+  prng_free(prng);
+  return 0;
+}
