os/ossrv/genericopenlibs/cstdlib/LTIME/GMTIME.C
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/cstdlib/LTIME/GMTIME.C	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,72 @@
     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 +* <<gmtime>>---convert time to UTC traditional form
    1.20 +* INDEX
    1.21 +* gmtime
    1.22 +* ANSI_SYNOPSIS
    1.23 +* #include <time.h>
    1.24 +* struct tm *gmtime(const time_t *<[clock]>);
    1.25 +* struct tm *gmtime_r(const time_t *<[clock]>, struct tm *<[res]>);
    1.26 +* TRAD_SYNOPSIS
    1.27 +* #include <time.h>
    1.28 +* struct tm *gmtime(<[clock]>)
    1.29 +* const time_t *<[clock]>;
    1.30 +* struct tm *gmtime_r(<[clock]>, <[res]>)
    1.31 +* const time_t *<[clock]>;
    1.32 +* struct tm *<[res]>;
    1.33 +* <<gmtime>> assumes the time at <[clock]> represents a local time.
    1.34 +* <<gmtime>> converts it to UTC (Universal Coordinated Time, also known in some
    1.35 +* countries as GMT, Greenwich Mean time), then converts the
    1.36 +* representation from the arithmetic representation to
    1.37 +* the traditional representation defined by <<struct tm>>.
    1.38 +* <<gmtime>> constructs the traditional time representation in static
    1.39 +* storage; each call to <<gmtime>> or <<localtime>> will overwrite the
    1.40 +* information generated by previous calls to either function.
    1.41 +* RETURNS
    1.42 +* A pointer to the traditional time representation (<<struct tm>>).
    1.43 +* PORTABILITY
    1.44 +* ANSI C requires <<gmtime>>.
    1.45 +* <<gmtime>> requires no supporting OS subroutines.
    1.46 +* 
    1.47 +*
    1.48 +*/
    1.49 +
    1.50 +
    1.51 +
    1.52 +#include <sys/reent.h>
    1.53 +#include <time.h>
    1.54 +
    1.55 +#ifndef _REENT_ONLY
    1.56 +
    1.57 +/**
    1.58 +Convert time_t value to tm structure as UTC time.
    1.59 +Converts timer to tm structure adjusting to 
    1.60 +UTC (formerly known as GMT) timezone.  
    1.61 +@return A pointer to a tm structure.
    1.62 +This structure is statically allocated and shared by gmtime,
    1.63 +localtime and ctime functions. 
    1.64 +Each time one of these functions is called the content of
    1.65 +the structure is overwritten.
    1.66 +@param tim_p pointer to a time_t value, 
    1.67 +usually returned by time function.
    1.68 +*/
    1.69 +EXPORT_C struct tm *
    1.70 +gmtime (const time_t * tim_p)
    1.71 +{
    1.72 +  return gmtime_r (tim_p, &(_REENT->_struct_tm));
    1.73 +}
    1.74 +
    1.75 +#endif