Tor  0.4.7.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-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 /**
8  * \file time_fmt.h
9  *
10  * \brief Header for time_fmt.c
11  **/
12 
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) */
int parse_http_time(const char *buf, struct tm *tm)
Definition: time_fmt.c:409
void format_iso_time_nospace(char *buf, time_t t)
Definition: time_fmt.c:313
void format_rfc1123_time(char *buf, time_t t)
Definition: time_fmt.c:182
void format_iso_time_nospace_usec(char *buf, const struct timeval *tv)
Definition: time_fmt.c:323
void format_iso_time(char *buf, time_t t)
Definition: time_fmt.c:295
int parse_iso_time_(const char *cp, time_t *t, int strict, int nospace)
Definition: time_fmt.c:336
void format_local_iso_time_nospace(char *buf, time_t t)
Definition: time_fmt.c:304
int parse_rfc1123_time(const char *buf, time_t *t)
Definition: time_fmt.c:206
void format_local_iso_time(char *buf, time_t t)
Definition: time_fmt.c:285
int parse_iso_time(const char *buf, time_t *t)
Definition: time_fmt.c:392
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
int format_time_interval(char *out, size_t out_len, long interval)
Definition: time_fmt.c:481
int parse_iso_time_nospace(const char *cp, time_t *t)
Definition: time_fmt.c:401
struct tm * tor_localtime_r(const time_t *timep, struct tm *result)
Definition: time_fmt.c:46