Last change
on this file since 444 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
|
Rev | Line | |
---|
[444] | 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 | /* |
---|
| 12 | FUNCTION |
---|
| 13 | <<gmtime>>---convert time to UTC traditional form |
---|
| 14 | |
---|
| 15 | INDEX |
---|
| 16 | gmtime |
---|
| 17 | INDEX |
---|
| 18 | gmtime_r |
---|
| 19 | |
---|
| 20 | SYNOPSIS |
---|
| 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 | |
---|
| 25 | DESCRIPTION |
---|
| 26 | <<gmtime>> takes the time at <[clock]> representing the number |
---|
| 27 | of elapsed seconds since 00:00:00 on January 1, 1970, Universal |
---|
| 28 | Coordinated Time (UTC, also known in some countries as GMT, |
---|
| 29 | Greenwich Mean time) and converts it to a <<struct tm>> |
---|
| 30 | representation. |
---|
| 31 | |
---|
| 32 | <<gmtime>> constructs the traditional time representation in static |
---|
| 33 | storage; each call to <<gmtime>> or <<localtime>> will overwrite the |
---|
| 34 | information generated by previous calls to either function. |
---|
| 35 | |
---|
| 36 | RETURNS |
---|
| 37 | A pointer to the traditional time representation (<<struct tm>>). |
---|
| 38 | |
---|
| 39 | PORTABILITY |
---|
| 40 | ANSI 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 | |
---|
| 52 | struct tm * |
---|
| 53 | gmtime (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.