os/ossrv/genericopenlibs/cstdlib/LTIME/ASCTIME.C
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/cstdlib/LTIME/ASCTIME.C	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,68 @@
     1.4 +/*
     1.5 +* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:
    1.18 +* FUNCTION
    1.19 +* <<asctime>>---format time as string
    1.20 +* INDEX
    1.21 +* asctime
    1.22 +* INDEX
    1.23 +* _asctime_r
    1.24 +* ANSI_SYNOPSIS
    1.25 +* #include <time.h>
    1.26 +* char *asctime(const struct tm *<[clock]>);
    1.27 +* char *asctime_r(const struct tm *<[clock]>, char *<[buf]>);
    1.28 +* TRAD_SYNOPSIS
    1.29 +* #include <time.h>
    1.30 +* char *asctime(<[clock]>)
    1.31 +* struct tm *<[clock]>;
    1.32 +* char *asctime_r(<[clock]>)
    1.33 +* struct tm *<[clock]>;
    1.34 +* char *<[buf]>;
    1.35 +* Format the time value at <[clock]> into a string of the form
    1.36 +* . Wed Jun 15 11:38:07 1988\n\0
    1.37 +* The string is generated in a static buffer; each call to <<asctime>>
    1.38 +* overwrites the string generated by previous calls.
    1.39 +* RETURNS
    1.40 +* A pointer to the string containing a formatted timestamp.
    1.41 +* PORTABILITY
    1.42 +* ANSI C requires <<asctime>>.
    1.43 +* <<asctime>> requires no supporting OS subroutines.
    1.44 +* 
    1.45 +*
    1.46 +*/
    1.47 +
    1.48 +
    1.49 +
    1.50 +#include <time.h>
    1.51 +#include <sys/reent.h>
    1.52 +
    1.53 +#ifndef _REENT_ONLY
    1.54 +
    1.55 +/**
    1.56 +Convert tm structure to string.
    1.57 +Converts data pointed by tim_p to a string containing time and date in readable format.
    1.58 +@return A pointer to the string containing the date
    1.59 +and time information in readable format.
    1.60 +The string pointed is statically allocated and 
    1.61 +shared by ctime and asctime functions. 
    1.62 +Each time one of these functions is called the content of the string is overwritten.
    1.63 +@param tim_p Pointer to tm structure containing time and date information to be converted.
    1.64 +*/
    1.65 +EXPORT_C char *
    1.66 +asctime (const struct tm *tim_p)
    1.67 +{
    1.68 +  return asctime_r (tim_p, _REENT->_asctime);
    1.69 +}
    1.70 +
    1.71 +#endif