source: trunk/libs/newlib/src/newlib/libc/time/gmtime.c @ 543

Last change on this file since 543 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.4 KB
Line 
1/*
2 * gmtime.c
3 * Original Author:     G. Haley
4 *
5 * Converts the calendar time pointed to by tim_p into a broken-down time
6 * expressed as Greenwich Mean Time (GMT). Returns a pointer to a structure
7 * containing the broken-down time, or a null pointer if GMT is not
8 * available.
9 */
10
11/*
12FUNCTION
13<<gmtime>>---convert time to UTC traditional form
14
15INDEX
16        gmtime
17INDEX
18        gmtime_r
19
20SYNOPSIS
21        #include <time.h>
22        struct tm *gmtime(const time_t *<[clock]>);
23        struct tm *gmtime_r(const time_t *<[clock]>, struct tm *<[res]>);
24
25DESCRIPTION
26<<gmtime>> takes the time at <[clock]> representing the number
27of elapsed seconds since 00:00:00 on January 1, 1970, Universal
28Coordinated Time (UTC, also known in some countries as GMT,
29Greenwich Mean time) and converts it to a <<struct tm>>
30representation.
31
32<<gmtime>> constructs the traditional time representation in static
33storage; each call to <<gmtime>> or <<localtime>> will overwrite the
34information generated by previous calls to either function.
35
36RETURNS
37A pointer to the traditional time representation (<<struct tm>>).
38
39PORTABILITY
40ANSI C requires <<gmtime>>.
41
42<<gmtime>> requires no supporting OS subroutines.
43*/
44
45#include <stdlib.h>
46#include <time.h>
47
48#define _GMT_OFFSET 0
49
50#ifndef _REENT_ONLY
51
52struct tm *
53gmtime (const time_t * tim_p)
54{
55  struct _reent *reent = _REENT;
56
57  _REENT_CHECK_TM(reent);
58  return gmtime_r (tim_p, (struct tm *)_REENT_TM(reent));
59}
60
61#endif
Note: See TracBrowser for help on using the repository browser.