First public contribution.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\earlyextension\earlyextension.cpp
15 // This is to test the registration of early extension and will do the following
16 // - Constructing the static data in VariantInit0 (the main extension object)
17 // - In Init3 entrypoint allocating space in Kernel Heap to store the time stamp obtained
18 // calling Kern::SystemTime().
19 // - Supplying one exported function to allow reading the time stamp.
24 #include <kernel/kernel.h>
25 #include "earlyextension.h"
27 static TestEarlyExtension* EarlyExtension;
29 /** Registering as early extension */
30 DECLARE_EXTENSION_WITH_PRIORITY(EARLY_EXTENSION_PRIORITY)
32 TestEarlyExtension* ee = new TestEarlyExtension;
36 EarlyExtension->iTime = new TTimeK; //Allocate memory for storing time stamp.
37 if(!EarlyExtension->iTime)
39 *EarlyExtension->iTime = Kern::SystemTime(); //Store time stamp
40 // wait one tick to guarantee that system time will be different if called from the entry point of a following extension
45 /** This function allows to read the time stamp taken during the init3 entry point */
46 EXPORT_C void TestEarlyExtension::GetTimeStamp(TTimeK& aTime)
48 if(!EarlyExtension->iTime)
53 aTime = *EarlyExtension->iTime;