home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 4 / CDPD_IV.bin / networking / uucp / amigauucpsrc / lib / date.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-29  |  748 b   |  37 lines

  1.  
  2. /*
  3.  *  DATE.C
  4.  */
  5.  
  6. #include <string.h>
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9. #include <time.h>
  10. #include "config.h"
  11.  
  12. Prototype char *atime(time_t *);
  13.  
  14. char *
  15. atime(pt)
  16. time_t *pt;
  17. {
  18.     static char buf[40];
  19.     static char *mo[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
  20.                 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
  21.             };
  22.     static char *dow[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
  23.     static char *TimeZoneName;
  24.     struct tm *ut = localtime(pt);
  25.  
  26.     if (TimeZoneName == NULL)
  27.     TimeZoneName = FindConfig("TimeZone");
  28.  
  29.     sprintf(buf, "%s, %d %s %02d %02d:%02d:%02d %s",
  30.     dow[ut->tm_wday], ut->tm_mday, mo[ut->tm_mon],
  31.     ut->tm_year % 100, ut->tm_hour, ut->tm_min, ut->tm_sec,
  32.     TimeZoneName
  33.     );
  34.     return(buf);
  35. }
  36.  
  37.