Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  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. ANSI_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. TRAD_SYNOPSIS
  26.         #include <time.h>
  27.         struct tm *gmtime(<[clock]>)
  28.         const time_t *<[clock]>;
  29.         struct tm *gmtime_r(<[clock]>, <[res]>)
  30.         const time_t *<[clock]>;
  31.         struct tm *<[res]>;
  32.  
  33. DESCRIPTION
  34. <<gmtime>> takes the time at <[clock]> representing the number
  35. of elapsed seconds since 00:00:00 on January 1, 1970, Universal
  36. Coordinated Time (UTC, also known in some countries as GMT,
  37. Greenwich Mean time) and converts it to a <<struct tm>>
  38. representation.
  39.  
  40. <<gmtime>> constructs the traditional time representation in static
  41. storage; each call to <<gmtime>> or <<localtime>> will overwrite the
  42. information generated by previous calls to either function.
  43.  
  44. RETURNS
  45. A pointer to the traditional time representation (<<struct tm>>).
  46.  
  47. PORTABILITY
  48. ANSI C requires <<gmtime>>.
  49.  
  50. <<gmtime>> requires no supporting OS subroutines.
  51. */
  52.  
  53. #include <stdlib.h>
  54. #include <time.h>
  55.  
  56. #define _GMT_OFFSET 0
  57.  
  58. #ifndef _REENT_ONLY
  59.  
  60. struct tm *
  61. _DEFUN (gmtime, (tim_p),
  62.         _CONST time_t * tim_p)
  63. {
  64.   _REENT_CHECK_TM(_REENT);
  65.   return gmtime_r (tim_p, (struct tm *)_REENT_TM(_REENT));
  66. }
  67.  
  68. #endif
  69.