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