*
*/
-#include "mem_config.h"
+#include "libtest/yatlcon.h"
+
#include <libtest/common.h>
#include <sys/time.h>
void set_alarm(long tv_sec, long tv_usec)
{
-#if defined(TARGET_OS_OSX) && TARGET_OS_OSX
+ // For the moment use any value to YATL_ALARM to cancel alarming.
+ if (getenv("YATL_ALARM"))
+ {
+ errno= 0;
+ tv_sec= strtol(getenv("YATL_ALARM"), (char **) NULL, 10);
+
+ if (errno != 0)
+ {
+ FATAL("Bad value for YATL_ALARM");
+ }
+ else if (tv_sec == 0)
+ {
+ cancel_alarm();
+ }
+ }
+
+#ifdef __APPLE__
struct timeval it_value= { time_t(tv_sec), suseconds_t(tv_usec) };
#else
struct timeval it_value= { tv_sec, tv_usec };