uiacceltk/hitchcock/backgroundanim/src/highrestimer.cpp
changeset 0 15bf7259bb7c
child 8 10534483575f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/hitchcock/backgroundanim/src/highrestimer.cpp	Tue Feb 02 07:56:43 2010 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include "highrestimer.h"
+
+
+CHighResTimer* CHighResTimer::NewL(TCallBack aCallBack, TInt aPriority)
+	{
+	CHighResTimer* self = new(ELeave) CHighResTimer(aCallBack, aPriority);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CHighResTimer::~CHighResTimer()
+	{
+	Cancel();
+	}
+
+void CHighResTimer::CallBack(const TInt aWaitInMilliSecs)
+	{
+	TInt wait = aWaitInMilliSecs*1000;
+	if (wait < 1000)
+	    {
+	    wait = 1000;
+	    }
+	if (wait > 15000)
+	    {
+	    wait = 15000;
+	    }
+            
+    HighRes( TTimeIntervalMicroSeconds32( wait ) );
+	}
+	
+CHighResTimer::CHighResTimer(TCallBack aCallBack, TInt aPriority) 
+	: CTimer(aPriority), iCallBack(aCallBack)
+		{
+		CActiveScheduler::Add(this);
+		}
+
+void CHighResTimer::RunL()
+	{
+	if (iStatus.Int() != KErrCancel)
+	    {
+	    iCallBack.CallBack();
+	    }
+	}
+