os/ossrv/genericopenlibs/cstdlib/LTIME/LCLTIME.C
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 * <<localtime>>---convert time to local representation
    17 * INDEX
    18 * localtime
    19 * ANSI_SYNOPSIS
    20 * #include <time.h>
    21 * struct tm *localtime(time_t *<[clock]>);
    22 * struct tm *localtime_r(time_t *<[clock]>, struct tm *<[res]>);
    23 * TRAD_SYNOPSIS
    24 * #include <time.h>
    25 * struct tm *localtime(<[clock]>)
    26 * time_t *<[clock]>;
    27 * struct tm *localtime(<[clock]>, <[res]>)
    28 * time_t *<[clock]>;
    29 * struct tm *<[res]>;
    30 * <<localtime>> converts the time at <[clock]> into local time, then
    31 * converts its representation from the arithmetic representation to the
    32 * traditional representation defined by <<struct tm>>.
    33 * <<localtime>> constructs the traditional time representation in static
    34 * storage; each call to <<gmtime>> or <<localtime>> will overwrite the
    35 * information generated by previous calls to either function.
    36 * <<mktime>> is the inverse of <<localtime>>.
    37 * RETURNS
    38 * A pointer to the traditional time representation (<<struct tm>>).
    39 * PORTABILITY
    40 * ANSI C requires <<localtime>>.
    41 * <<localtime>> requires no supporting OS subroutines.
    42 * 
    43 *
    44 */
    45 
    46 
    47 
    48 #include <time.h>
    49 #include <sys/reent.h>
    50 
    51 #ifndef _REENT_ONLY
    52 
    53 /**
    54 Convert time_t value to tm structure as local time.
    55 Converts timer to tm structure adjusting to the local time zone.
    56 @return A pointer to a tm structure.
    57 This structure is statically allocated and shared by gmtime, 
    58 localtime and ctime functions.
    59 Each time one of these functions is called the content 
    60 of the structure is overwritten.
    61 @param tim_p pointer to a time_t value, 
    62 usually returned by time function.
    63 */
    64 EXPORT_C struct tm *
    65 localtime (const time_t * tim_p)
    66 {
    67   return localtime_r (tim_p, &(_REENT->_struct_tm));
    68 }
    69 
    70 #endif