genericopenlibs/openenvcore/libc/test/testcapsystime/src/tsystime_captest.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 
       
     2 // Copyright (c) 2006-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".
       
     8 //
       
     9 // Initial Contributors:
       
    10 // Nokia Corporation - initial contribution.
       
    11 //
       
    12 // Contributors:
       
    13 //
       
    14 // Description:
       
    15 // Name        : tsystime_captest.cpp
       
    16 // 
       
    17 //
       
    18 
       
    19 #include "tsystime.h"
       
    20 #include <sys/time.h>
       
    21 #include <e32err.h>
       
    22 #include <sys/stat.h>
       
    23 #include <stdio.h>
       
    24 
       
    25 #define MAX_LEN  20
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 
       
    30 
       
    31 /*
       
    32 -------------------------------------------------------------------------------
       
    33 Function Name		: CTestsystime::utimesys
       
    34 API Tested			: utimesys for capability
       
    35 
       
    36 -------------------------------------------------------------------------------
       
    37 */
       
    38 
       
    39 TInt CTestsystime::utimessys()
       
    40 	{
       
    41 	INFO_PRINTF1(_L("utimessys"));
       
    42     int i;
       
    43     struct timeval times[2];	
       
    44     times[0].tv_sec=1000;
       
    45     times[0].tv_usec=1000;
       
    46     times[1].tv_sec=100;
       
    47     times[1].tv_usec=100;
       
    48  	i=utimes("z:\\sys\\file5.txt",times ); 
       
    49 
       
    50   	if  (i < 0 ) 
       
    51 		 {
       
    52 	     INFO_PRINTF2(_L("errno=%d\n"),errno);
       
    53          return errno;
       
    54 		 }
       
    55 	return KErrNone;
       
    56 	}
       
    57 	
       
    58 	
       
    59 /*
       
    60 -------------------------------------------------------------------------------
       
    61 Function Name		: CTestsystime::utimesprivate
       
    62 API Tested			: utimesprivate for capability
       
    63 
       
    64 -------------------------------------------------------------------------------
       
    65 */
       
    66 
       
    67 TInt CTestsystime::utimesprivate()
       
    68 	{
       
    69 	INFO_PRINTF1(_L("utimesprivate"));
       
    70     int i;
       
    71     struct timeval times[2];	
       
    72     times[0].tv_sec=1000;
       
    73     times[0].tv_usec=1000;
       
    74  	times[1].tv_sec=100;
       
    75   	times[1].tv_usec=100;
       
    76  	i=utimes("z:\\private\\10202be9\\file5.txt",times );
       
    77 
       
    78   	if  (i < 0 ) 
       
    79 		{
       
    80 	    INFO_PRINTF2(_L("errno=%d\n"),errno);
       
    81         return errno;
       
    82 		}
       
    83 	return KErrNone;
       
    84 	}