1 #ifndef DATE_H
2 #define DATE_H
3 
4 #include <vstr.h>
5 
6 #if VSTR_AUTOCONF_TIME_WITH_SYS_TIME
7 # include <sys/time.h>
8 # include <time.h>
9 #else
10 # if VSTR_AUTOCONF_HAVE_SYS_TIME_H
11 #  include <sys/time.h>
12 # else
13 #  include <time.h>
14 # endif
15 #endif
16 
17 #define DATE__RET_SZ    128
18 #define DATE__CACHE_NUM   4
19 
20 typedef struct Date_store
21 {
22  unsigned int saved_count;
23  time_t    saved_val[DATE__CACHE_NUM];
24  struct tm saved_tm[DATE__CACHE_NUM];
25  char ret_buf[DATE__RET_SZ];
26 } Date_store;
27 
28 extern Date_store *date_make(void);
29 extern void date_free(Date_store *);
30 
31 extern const struct tm *date_gmtime(Date_store *, time_t);
32 
33 extern const char *date_rfc1123(Date_store *, time_t);
34 extern const char *date_rfc850(Date_store *, time_t);
35 extern const char *date_asctime(Date_store *, time_t);
36 
37 extern const char *date_syslog(time_t, char *, size_t);
38 
39 #endif
40