tor  0.4.2.0-alpha-dev
time_fmt.h
Go to the documentation of this file.
1 /* Copyright (c) 2001, Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2019, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
13 #ifndef TOR_TIME_FMT_H
14 #define TOR_TIME_FMT_H
15 
16 #include "orconfig.h"
17 #ifdef HAVE_SYS_TYPES_H
18 #include <sys/types.h>
19 #endif
20 
21 struct tm;
22 struct timeval;
23 
24 struct tm *tor_localtime_r(const time_t *timep, struct tm *result);
25 struct tm *tor_gmtime_r(const time_t *timep, struct tm *result);
26 int tor_timegm(const struct tm *tm, time_t *time_out);
27 
28 #define RFC1123_TIME_LEN 29
29 void format_rfc1123_time(char *buf, time_t t);
30 int parse_rfc1123_time(const char *buf, time_t *t);
31 #define ISO_TIME_LEN 19
32 #define ISO_TIME_USEC_LEN (ISO_TIME_LEN+7)
33 void format_local_iso_time(char *buf, time_t t);
34 void format_iso_time(char *buf, time_t t);
35 void format_local_iso_time_nospace(char *buf, time_t t);
36 void format_iso_time_nospace(char *buf, time_t t);
37 void format_iso_time_nospace_usec(char *buf, const struct timeval *tv);
38 int parse_iso_time_(const char *cp, time_t *t, int strict, int nospace);
39 int parse_iso_time(const char *buf, time_t *t);
40 int parse_iso_time_nospace(const char *cp, time_t *t);
41 int parse_http_time(const char *buf, struct tm *tm);
42 int format_time_interval(char *out, size_t out_len, long interval);
43 
44 #endif /* !defined(TOR_TIME_FMT_H) */
void format_rfc1123_time(char *buf, time_t t)
Definition: time_fmt.c:182
int format_time_interval(char *out, size_t out_len, long interval)
Definition: time_fmt.c:481
void format_iso_time_nospace_usec(char *buf, const struct timeval *tv)
Definition: time_fmt.c:323
int parse_rfc1123_time(const char *buf, time_t *t)
Definition: time_fmt.c:206
void format_iso_time_nospace(char *buf, time_t t)
Definition: time_fmt.c:313
struct tm * tor_localtime_r(const time_t *timep, struct tm *result)
Definition: time_fmt.c:46
void format_iso_time(char *buf, time_t t)
Definition: time_fmt.c:295
void format_local_iso_time_nospace(char *buf, time_t t)
Definition: time_fmt.c:304
void format_local_iso_time(char *buf, time_t t)
Definition: time_fmt.c:285
int parse_iso_time_nospace(const char *cp, time_t *t)
Definition: time_fmt.c:401
int parse_iso_time(const char *buf, time_t *t)
Definition: time_fmt.c:392
int parse_iso_time_(const char *cp, time_t *t, int strict, int nospace)
Definition: time_fmt.c:336
int parse_http_time(const char *buf, struct tm *tm)
Definition: time_fmt.c:409
int tor_timegm(const struct tm *tm, time_t *time_out)
Definition: time_fmt.c:96
struct tm * tor_gmtime_r(const time_t *timep, struct tm *result)
Definition: time_fmt.c:65