sl@0: /*
sl@0: * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: * All rights reserved.
sl@0: * This component and the accompanying materials are made available
sl@0: * under the terms of "Eclipse Public License v1.0"
sl@0: * which accompanies this distribution, and is available
sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: *
sl@0: * Initial Contributors:
sl@0: * Nokia Corporation - initial contribution.
sl@0: *
sl@0: * Contributors:
sl@0: *
sl@0: * Description:
sl@0: * FUNCTION
sl@0: * <<localtime>>---convert time to local representation
sl@0: * INDEX
sl@0: * localtime
sl@0: * ANSI_SYNOPSIS
sl@0: * #include <time.h>
sl@0: * struct tm *localtime(time_t *<[clock]>);
sl@0: * struct tm *localtime_r(time_t *<[clock]>, struct tm *<[res]>);
sl@0: * TRAD_SYNOPSIS
sl@0: * #include <time.h>
sl@0: * struct tm *localtime(<[clock]>)
sl@0: * time_t *<[clock]>;
sl@0: * struct tm *localtime(<[clock]>, <[res]>)
sl@0: * time_t *<[clock]>;
sl@0: * struct tm *<[res]>;
sl@0: * <<localtime>> converts the time at <[clock]> into local time, then
sl@0: * converts its representation from the arithmetic representation to the
sl@0: * traditional representation defined by <<struct tm>>.
sl@0: * <<localtime>> constructs the traditional time representation in static
sl@0: * storage; each call to <<gmtime>> or <<localtime>> will overwrite the
sl@0: * information generated by previous calls to either function.
sl@0: * <<mktime>> is the inverse of <<localtime>>.
sl@0: * RETURNS
sl@0: * A pointer to the traditional time representation (<<struct tm>>).
sl@0: * PORTABILITY
sl@0: * ANSI C requires <<localtime>>.
sl@0: * <<localtime>> requires no supporting OS subroutines.
sl@0: * 
sl@0: *
sl@0: */
sl@0: 
sl@0: 
sl@0: 
sl@0: #include <time.h>
sl@0: #include <sys/reent.h>
sl@0: 
sl@0: #ifndef _REENT_ONLY
sl@0: 
sl@0: /**
sl@0: Convert time_t value to tm structure as local time.
sl@0: Converts timer to tm structure adjusting to the local time zone.
sl@0: @return A pointer to a tm structure.
sl@0: This structure is statically allocated and shared by gmtime, 
sl@0: localtime and ctime functions.
sl@0: Each time one of these functions is called the content 
sl@0: of the structure is overwritten.
sl@0: @param tim_p pointer to a time_t value, 
sl@0: usually returned by time function.
sl@0: */
sl@0: EXPORT_C struct tm *
sl@0: localtime (const time_t * tim_p)
sl@0: {
sl@0:   return localtime_r (tim_p, &(_REENT->_struct_tm));
sl@0: }
sl@0: 
sl@0: #endif