os/ossrv/genericopenlibs/posixrealtimeextensions/test/testcapclock/src/tcapclockblocks.cpp
Update contrib.
2 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
3 // All rights reserved.
4 // This component and the accompanying materials are made available
5 // under the terms of "Eclipse Public License v1.0"
6 // which accompanies this distribution, and is available
7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 // Initial Contributors:
10 // Nokia Corporation - initial contribution.
15 // Name : tcapclockblocks.cpp
19 #include "tcapclock.h"
21 // -----------------------------------------------------------------------------
22 // CTesttrapsignal::Testcapclocksettime1()
24 // API tested: clock_settime()
25 // Description: Capability test for clock_settime()
26 // -----------------------------------------------------------------------------
28 TInt Ctestcapclock::Testcapclocksettime1()
30 int ret, ret1 = KErrGeneral;
32 struct timespec stmspec, gtmspec;
33 ret = clock_getcpuclockid(0,&clockid);
36 ERR_PRINTF2(_L("Failed to retrieve the clock id of the calling process and errno is %d"),errno);
40 stmspec.tv_nsec = 100000;
41 ret = clock_settime(clockid,&stmspec);
44 ERR_PRINTF2(_L("Failed to get the time of specified clock id and errno is %d"),errno);
47 INFO_PRINTF1(_L("clock_settime() successfully able to set the time") );
48 ret = clock_gettime(clockid,>mspec);
51 ERR_PRINTF2(_L("Failed to get the time of specified clock id and errno is %d"),errno);
54 if (gtmspec.tv_sec < stmspec.tv_sec)
56 ERR_PRINTF2(_L("Failed to retrieve resolution of the clock id specified and errno is %d"),errno);
59 INFO_PRINTF1(_L("clock_gettime() successfully able to get the time") );