home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / compiler / clib / localtime.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-29  |  2.0 KB  |  94 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: localtime.c,v 1.1 1997/01/29 16:51:35 digulla Exp $
  4.  
  5.     Desc: Convert a time into a string.
  6.     Lang: english
  7. */
  8.  
  9. extern long __gmtoffset;
  10.  
  11. /*****************************************************************************
  12.  
  13.     NAME */
  14. #include <time.h>
  15.  
  16.     struct tm * localtime (
  17.  
  18. /*  SYNOPSIS */
  19.     const time_t * tt)
  20.  
  21. /*  FUNCTION
  22.     Splits the system time in seconds into a structure.
  23.     The members of the tm structure are:
  24.  
  25.     \begin{description}
  26.     \item {tm_sec} The number of seconds after the minute, normally in
  27.         the range 0 to 59, but can be up to 61 to allow for leap
  28.         seconds.
  29.  
  30.     \item{tm_min} The number of minutes after the hour, in the range 0
  31.         to 59.
  32.  
  33.     \item{tm_hour} The number of hours past midnight, in the range 0 to
  34.         23.
  35.  
  36.     \item{tm_mday} The day of the month, in the range 1 to 31.
  37.  
  38.     \item{tm_mon} The number of months since January, in the range 0 to
  39.         11.
  40.  
  41.     \item{tm_year} The number of years since 1900.
  42.  
  43.     \item{tm_wday} The number of days since Sunday, in the range 0 to
  44.         6.
  45.  
  46.     \item{tm_yday} The number of days since January 1, in the range  0
  47.         to 365.
  48.  
  49.     \item{tm_isdst} A flag that indicates whether daylight saving time
  50.         is in effect at the time described. The value is positive
  51.         if daylight saving time is in effect, zero if it is not,
  52.         and negative if the information is not available.
  53.  
  54.     \end{description}
  55.  
  56.     INPUTS
  57.     tt - A time in seconds from the 1. Jan 1970
  58.  
  59.     RESULT
  60.     A statically allocated buffer with the broken up time. Note that
  61.     the contents of the buffer might get lost with the call of any of
  62.     the date and time functions.
  63.  
  64.     NOTES
  65.  
  66.     EXAMPLE
  67.     time_t        tt;
  68.     struct tm * tm;
  69.  
  70.     // Get time
  71.     time (&tt);
  72.  
  73.     // Break time up
  74.     tm = localtime (&tt);
  75.  
  76.     BUGS
  77.  
  78.     SEE ALSO
  79.     time(), ctime(), asctime()
  80.  
  81.     INTERNALS
  82.  
  83.     HISTORY
  84.     29.01.1997 digulla created
  85.  
  86. ******************************************************************************/
  87. {
  88.     time_t ti = *tt;
  89.  
  90.     ti -= __gmtoffset * 60;
  91.  
  92.     return gmtime (&ti);
  93. } /* localtime */
  94.