Subversion Repositories Kolibri OS

Rev

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

  1. /*
  2.  * localtime.c
  3.  */
  4.  
  5. /*
  6. FUNCTION
  7. <<localtime>>---convert time to local representation
  8.  
  9. INDEX
  10.         localtime
  11. INDEX
  12.         localtime_r
  13.  
  14. ANSI_SYNOPSIS
  15.         #include <time.h>
  16.         struct tm *localtime(time_t *<[clock]>);
  17.         struct tm *localtime_r(time_t *<[clock]>, struct tm *<[res]>);
  18.  
  19. TRAD_SYNOPSIS
  20.         #include <time.h>
  21.         struct tm *localtime(<[clock]>)
  22.         time_t *<[clock]>;
  23.         struct tm *localtime(<[clock]>, <[res]>)
  24.         time_t *<[clock]>;
  25.         struct tm *<[res]>;
  26.  
  27. DESCRIPTION
  28. <<localtime>> converts the time at <[clock]> into local time, then
  29. converts its representation from the arithmetic representation to the
  30. traditional representation defined by <<struct tm>>.
  31.  
  32. <<localtime>> 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. <<mktime>> is the inverse of <<localtime>>.
  37.  
  38. RETURNS
  39. A pointer to the traditional time representation (<<struct tm>>).
  40.  
  41. PORTABILITY
  42. ANSI C requires <<localtime>>.
  43.  
  44. <<localtime>> requires no supporting OS subroutines.
  45. */
  46.  
  47. #include <time.h>
  48. #include <reent.h>
  49.  
  50. #ifndef _REENT_ONLY
  51.  
  52. struct tm *
  53. _DEFUN (localtime, (tim_p),
  54.         _CONST time_t * tim_p)
  55. {
  56.   _REENT_CHECK_TM(_REENT);
  57.   return localtime_r (tim_p, (struct tm *)_REENT_TM(_REENT));
  58. }
  59.  
  60. #endif
  61.