↑ 1 /*
↑ 2 * This program is free software; you can redistribute it and/or modify
↑ 3 * it under the terms of the GNU General Public License as published by
↑ 4 * the Free Software Foundation; either version 2 of the License, or
↑ 5 * (at your option) any later version.
↑ 6 *
↑ 7 * This program is distributed in the hope that it will be useful,
↑ 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
↑ 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
↑10 * GNU Library General Public License for more details.
↑11 *
↑12 * You should have received a copy of the GNU General Public License
↑13 * along with this program; if not, write to the Free Software
↑14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
↑15 *
↑16 * Copyright (C) 2005-2006 Ralf Huesing <ralf@stormbind.net>
↑17 *
↑18 */
↑19
↑20 /*
↑21 *
↑22 * rh_gmtime - generate a gmt formatted time string:
↑23 *
↑24 * "Sat, 05 Nov 2005 17:22:26 GMT"
↑25 *
↑26 *
↑27 * rh_gmtime_init() initalizes the rh_gmtime_t type and writes the
↑28 * time string into the internal buffer.
↑29 *
↑30 * rh_gmtime_update() updates only nessecary sections of the
↑31 * time string, eg. only minutes and seconds, depending on the
↑32 * given time_t value. static parts of the string like " GMT"
↑33 * are not written. This is done once by calling rh_gmtime_init().
↑34 *
↑35 */
↑36
↑37 #ifndef RH_GMTIME_H
↑38 #define RH_GMTIME_H 1
↑39
↑40 #include <time.h>
↑41
↑42 #define GMT_LEN (sizeof("Sat, 05 Nov 2005 17:22:26 GMT")-1)
↑43
↑44 typedef
↑45 struct {
↑46 time_t t;
↑47 struct tm tm;
↑48 char data[GMT_LEN+1];
↑49 short used;
↑50 } rh_gmtime_t;
↑51
↑52 void rh_gmtime_init (rh_gmtime_t *gmt, time_t t);
↑53 void rh_gmtime_update (rh_gmtime_t *gmt, time_t t);
↑54
↑55 int rh_gmtime_reverse (const char *src, size_t nsrc, rh_gmtime_t *out);
↑56
↑57 #define rh_gmtime_cstr(_gmt) \
↑58 ((const char *)(_gmt)->b)
↑59
↑60 #endif /* ! RH_GMTIME_H */
syntax highlighted by Code2HTML, v. 0.9.1