[Box Backup-commit] COMMIT r1391 - box/chris/merge/lib/common

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Sat, 10 Mar 2007 16:53:56 +0000


Author: chris
Date: 2007-03-10 16:53:56 +0000 (Sat, 10 Mar 2007)
New Revision: 1391

Modified:
   box/chris/merge/lib/common/Timer.cpp
Log:
Win32 compile fixes (no gettimeofday(), no signal()) (refs #3)


Modified: box/chris/merge/lib/common/Timer.cpp
===================================================================
--- box/chris/merge/lib/common/Timer.cpp	2007-03-10 16:53:11 UTC (rev 1390)
+++ box/chris/merge/lib/common/Timer.cpp	2007-03-10 16:53:56 UTC (rev 1391)
@@ -144,10 +144,13 @@
 	{
 		THROW_EXCEPTION(CommonException, Internal)
 	}
+
+	#ifndef WIN32
 	if (::signal(SIGALRM, Timers::SignalHandler) != Timers::SignalHandler)
 	{
 		THROW_EXCEPTION(CommonException, Internal)
 	}
+	#endif
 
 	// Clear the reschedule-needed flag to false before we start.
 	// If a timer event occurs while we are scheduling, then we
@@ -255,7 +258,7 @@
 : mExpires(GetCurrentBoxTime() + SecondsToBoxTime(timeoutSecs)),
   mExpired(false)
 {
-	#ifndef NDEBUG
+	#if !defined NDEBUG && !defined WIN32
 	struct timeval tv;
 	gettimeofday(&tv, NULL);
 	if (timeoutSecs == 0)
@@ -285,7 +288,7 @@
 
 Timer::~Timer()
 {
-	#ifndef NDEBUG
+	#if !defined NDEBUG && !defined WIN32
 	struct timeval tv;
 	gettimeofday(&tv, NULL);
 	TRACE3("%d.%d: timer %p destroyed, will not fire\n",
@@ -299,7 +302,7 @@
 : mExpires(rToCopy.mExpires),
   mExpired(rToCopy.mExpired)
 {
-	#ifndef NDEBUG
+	#if !defined NDEBUG && !defined WIN32
 	struct timeval tv;
 	gettimeofday(&tv, NULL);
 	if (mExpired)
@@ -331,7 +334,7 @@
 
 Timer& Timer::operator=(const Timer& rToCopy)
 {
-	#ifndef NDEBUG
+	#if !defined NDEBUG && !defined WIN32
 	struct timeval tv;
 	gettimeofday(&tv, NULL);
 	if (rToCopy.mExpired)
@@ -367,7 +370,7 @@
 
 void Timer::OnExpire()
 {
-	#ifndef NDEBUG
+	#if !defined NDEBUG && !defined WIN32
 	struct timeval tv;
 	gettimeofday(&tv, NULL);
 	TRACE3("%d.%d: timer %p fired\n", tv.tv_sec, tv.tv_usec, this);