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