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: * <<ctime>>---convert time to local and format as string
sl@0: * INDEX
sl@0: * ctime
sl@0: * ANSI_SYNOPSIS
sl@0: * #include <time.h>
sl@0: * char *ctime(time_t <[clock]>);
sl@0: * char *ctime_r(time_t <[clock]>, char *<[buf]>);
sl@0: * TRAD_SYNOPSIS
sl@0: * #include <time.h>
sl@0: * char *ctime(<[clock]>)
sl@0: * time_t <[clock]>;
sl@0: * char *ctime_r(<[clock]>, <[buf]>)
sl@0: * time_t <[clock]>;
sl@0: * char *<[buf]>;
sl@0: * Convert the time value at <[clock]> to local time (like <<localtime>>)
sl@0: * and format it into a string of the form
sl@0: * . Wed Jun 15 11:38:07 1988\n\0
sl@0: * (like <<asctime>>).
sl@0: * RETURNS
sl@0: * A pointer to the string containing a formatted timestamp.
sl@0: * PORTABILITY
sl@0: * ANSI C requires <<ctime>>.
sl@0: * <<ctime>> 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 string.
sl@0: Converts tim_p to a string containing time 
sl@0: and date adjusted to local time zone in readable format.
sl@0: @return A pointer to the string containing the date 
sl@0: and time information in readable format.
sl@0: The string pointed is statically allocated 
sl@0: and shared by ctime and asctime functions. 
sl@0: Each time one of these functions is called 
sl@0: the content of the string 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 char *
sl@0: ctime (const time_t * tim_p)
sl@0: {
sl@0:   return ctime_r (tim_p, _REENT->_asctime);
sl@0: }
sl@0: 
sl@0: #endif