genericopenlibs/cstdlib/LTIME/DIFFTIME.C
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /*
       
     2 * Copyright (c) 1997-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 * FUNCTION
       
    16 * <<difftime>>---subtract two times
       
    17 * INDEX
       
    18 * difftime
       
    19 * ANSI_SYNOPSIS
       
    20 * #include <time.h>
       
    21 * double difftime(time_t <[tim1]>, time_t <[tim2]>);
       
    22 * TRAD_SYNOPSIS
       
    23 * #include <time.h>
       
    24 * double difftime(<[tim1]>, <[tim2]>)
       
    25 * time_t <[tim1]>;
       
    26 * time_t <[tim2]>;
       
    27 * Subtracts the two times in the arguments: `<<<[tim1]> - <[tim2]>>>'
       
    28 * that are in seconds.
       
    29 * RETURNS
       
    30 * The difference (in seconds) between <[tim2]> and <[tim1]>, as a <<double>>.
       
    31 * PORTABILITY
       
    32 * ANSI C requires <<difftime>>, and defines its result to be in seconds
       
    33 * in all implementations.
       
    34 * <<difftime>> requires no supporting OS subroutines.
       
    35 * 
       
    36 *
       
    37 */
       
    38 
       
    39 
       
    40 
       
    41 #include <time.h>
       
    42 
       
    43 /**
       
    44 Return difference between two times.
       
    45 Calculates the time difference between tim1 and tim2 in seconds.
       
    46 @return The difference in seconds between the two times specified.
       
    47 @param tim2 Latter time 
       
    48 @param tim1 Former time
       
    49 */
       
    50 EXPORT_C double
       
    51 difftime (time_t tim1, time_t tim2) __SOFTFP
       
    52 {
       
    53   return ((double) (tim1 - tim2));
       
    54 }