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.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description:
sl@0
    15
* FUNCTION
sl@0
    16
* <<localtime>>---convert time to local representation
sl@0
    17
* INDEX
sl@0
    18
* localtime
sl@0
    19
* ANSI_SYNOPSIS
sl@0
    20
* #include <time.h>
sl@0
    21
* struct tm *localtime(time_t *<[clock]>);
sl@0
    22
* struct tm *localtime_r(time_t *<[clock]>, struct tm *<[res]>);
sl@0
    23
* TRAD_SYNOPSIS
sl@0
    24
* #include <time.h>
sl@0
    25
* struct tm *localtime(<[clock]>)
sl@0
    26
* time_t *<[clock]>;
sl@0
    27
* struct tm *localtime(<[clock]>, <[res]>)
sl@0
    28
* time_t *<[clock]>;
sl@0
    29
* struct tm *<[res]>;
sl@0
    30
* <<localtime>> converts the time at <[clock]> into local time, then
sl@0
    31
* converts its representation from the arithmetic representation to the
sl@0
    32
* traditional representation defined by <<struct tm>>.
sl@0
    33
* <<localtime>> constructs the traditional time representation in static
sl@0
    34
* storage; each call to <<gmtime>> or <<localtime>> will overwrite the
sl@0
    35
* information generated by previous calls to either function.
sl@0
    36
* <<mktime>> is the inverse of <<localtime>>.
sl@0
    37
* RETURNS
sl@0
    38
* A pointer to the traditional time representation (<<struct tm>>).
sl@0
    39
* PORTABILITY
sl@0
    40
* ANSI C requires <<localtime>>.
sl@0
    41
* <<localtime>> requires no supporting OS subroutines.
sl@0
    42
* 
sl@0
    43
*
sl@0
    44
*/
sl@0
    45
sl@0
    46
sl@0
    47
sl@0
    48
#include <time.h>
sl@0
    49
#include <sys/reent.h>
sl@0
    50
sl@0
    51
#ifndef _REENT_ONLY
sl@0
    52
sl@0
    53
/**
sl@0
    54
Convert time_t value to tm structure as local time.
sl@0
    55
Converts timer to tm structure adjusting to the local time zone.
sl@0
    56
@return A pointer to a tm structure.
sl@0
    57
This structure is statically allocated and shared by gmtime, 
sl@0
    58
localtime and ctime functions.
sl@0
    59
Each time one of these functions is called the content 
sl@0
    60
of the structure is overwritten.
sl@0
    61
@param tim_p pointer to a time_t value, 
sl@0
    62
usually returned by time function.
sl@0
    63
*/
sl@0
    64
EXPORT_C struct tm *
sl@0
    65
localtime (const time_t * tim_p)
sl@0
    66
{
sl@0
    67
  return localtime_r (tim_p, &(_REENT->_struct_tm));
sl@0
    68
}
sl@0
    69
sl@0
    70
#endif