mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-15 19:09:58 +08:00
10d0021609
* libc/include/time.h (tzset, _tzset_r): Added prototypes. (strptime): Moved prototype to be within !__STRICT_ANSI__. (_tzname, _daylight, _timezone): No long __CYGWIN__ only. (tzname): Defined for all platforms. (daylight, timezone): Defined only for CYGWIN. * libc/sys/linux/machine/i386/crt0.c: Add call to tzset() after environment set up. * libc/stdlib/setenv_r.c (_setenv_r): Call tzset() if the TZ environment variable is set. * libc/time/Makefile.am: Add support for tzset.c, tzlock.c, and tzset_r.c. * libc/time/Makefile.in: Regenerated. * libc/time/gmtime.c (gmtime): Changed to call gmtime_r. * libc/time/gmtime_r.c (gmtime_r): Changed to call _mktm_r. * libc/time/lcltime_r.c (lcltime_r): Ditto. * libc/time/local.h: New local header file. * libc/time/mktime.c (mktime): Add timezone support. * libc/time/mktm_r.c: New file which is the common engine for gmtime_r and lcltime_r. This code has timezone support. * libc/time/strftime.c (strftime): Add %Z timezone support. * libc/time/tzlock.c: New file containing timezone lock stubs. * libc/time/tzset.c: New file containing tzset() routine. * libc/time/tzset_r.c: New file containing _tzset_r and internal routine for calculating timezone changes for specified year.
67 lines
1.6 KiB
C
67 lines
1.6 KiB
C
/*
|
|
* gmtime.c
|
|
* Original Author: G. Haley
|
|
*
|
|
* Converts the calendar time pointed to by tim_p into a broken-down time
|
|
* expressed as Greenwich Mean Time (GMT). Returns a pointer to a structure
|
|
* containing the broken-down time, or a null pointer if GMT is not
|
|
* available.
|
|
*/
|
|
|
|
/*
|
|
FUNCTION
|
|
<<gmtime>>---convert time to UTC traditional form
|
|
|
|
INDEX
|
|
gmtime
|
|
|
|
ANSI_SYNOPSIS
|
|
#include <time.h>
|
|
struct tm *gmtime(const time_t *<[clock]>);
|
|
struct tm *gmtime_r(const time_t *<[clock]>, struct tm *<[res]>);
|
|
|
|
TRAD_SYNOPSIS
|
|
#include <time.h>
|
|
struct tm *gmtime(<[clock]>)
|
|
const time_t *<[clock]>;
|
|
struct tm *gmtime_r(<[clock]>, <[res]>)
|
|
const time_t *<[clock]>;
|
|
struct tm *<[res]>;
|
|
|
|
DESCRIPTION
|
|
<<gmtime>> assumes the time at <[clock]> represents a local time.
|
|
<<gmtime>> converts it to UTC (Universal Coordinated Time, also known in some
|
|
countries as GMT, Greenwich Mean time), then converts the
|
|
representation from the arithmetic representation to
|
|
the traditional representation defined by <<struct tm>>.
|
|
|
|
<<gmtime>> constructs the traditional time representation in static
|
|
storage; each call to <<gmtime>> or <<localtime>> will overwrite the
|
|
information generated by previous calls to either function.
|
|
|
|
RETURNS
|
|
A pointer to the traditional time representation (<<struct tm>>).
|
|
|
|
PORTABILITY
|
|
ANSI C requires <<gmtime>>.
|
|
|
|
<<gmtime>> requires no supporting OS subroutines.
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <time.h>
|
|
|
|
#define _GMT_OFFSET 0
|
|
|
|
#ifndef _REENT_ONLY
|
|
|
|
struct tm *
|
|
_DEFUN (gmtime, (tim_p),
|
|
_CONST time_t * tim_p)
|
|
{
|
|
_REENT_CHECK_TM(_REENT);
|
|
return gmtime_r (tim_p, (struct tm *)_REENT_TM(_REENT));
|
|
}
|
|
|
|
#endif
|