os/ossrv/genericopenlibs/cstdlib/LTIME/ASCTIME.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 * <<asctime>>---format time as string
    17 * INDEX
    18 * asctime
    19 * INDEX
    20 * _asctime_r
    21 * ANSI_SYNOPSIS
    22 * #include <time.h>
    23 * char *asctime(const struct tm *<[clock]>);
    24 * char *asctime_r(const struct tm *<[clock]>, char *<[buf]>);
    25 * TRAD_SYNOPSIS
    26 * #include <time.h>
    27 * char *asctime(<[clock]>)
    28 * struct tm *<[clock]>;
    29 * char *asctime_r(<[clock]>)
    30 * struct tm *<[clock]>;
    31 * char *<[buf]>;
    32 * Format the time value at <[clock]> into a string of the form
    33 * . Wed Jun 15 11:38:07 1988\n\0
    34 * The string is generated in a static buffer; each call to <<asctime>>
    35 * overwrites the string generated by previous calls.
    36 * RETURNS
    37 * A pointer to the string containing a formatted timestamp.
    38 * PORTABILITY
    39 * ANSI C requires <<asctime>>.
    40 * <<asctime>> requires no supporting OS subroutines.
    41 * 
    42 *
    43 */
    44 
    45 
    46 
    47 #include <time.h>
    48 #include <sys/reent.h>
    49 
    50 #ifndef _REENT_ONLY
    51 
    52 /**
    53 Convert tm structure to string.
    54 Converts data pointed by tim_p to a string containing time and date in readable format.
    55 @return A pointer to the string containing the date
    56 and time information in readable format.
    57 The string pointed is statically allocated and 
    58 shared by ctime and asctime functions. 
    59 Each time one of these functions is called the content of the string is overwritten.
    60 @param tim_p Pointer to tm structure containing time and date information to be converted.
    61 */
    62 EXPORT_C char *
    63 asctime (const struct tm *tim_p)
    64 {
    65   return asctime_r (tim_p, _REENT->_asctime);
    66 }
    67 
    68 #endif