char *get_RFC1123date(long *date) { char D[STRLEN]; time_t now= (date && (*date>0))?*date:time(&now); long timezone_h; long timezone_m; int datelen; time(&now); tzset(); timezone_h= -(timezone/3600)+daylight; timezone_m= abs(timezone/60)%60; datelen=strftime(D, STRLEN-7, "%a, %d %b %Y %H:%M:%S", localtime(&now)); if ( ! datelen ) { memset(D, 0, STRLEN); } else { snprintf(D+datelen, 7, " %+03ld%02ld", timezone_h, timezone_m); } return xstrdup(D); }