Tor  0.4.6.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-2020, 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) */
format_time_interval
int format_time_interval(char *out, size_t out_len, long interval)
Definition: time_fmt.c:481
format_iso_time_nospace_usec
void format_iso_time_nospace_usec(char *buf, const struct timeval *tv)
Definition: time_fmt.c:323
parse_rfc1123_time
int parse_rfc1123_time(const char *buf, time_t *t)
Definition: time_fmt.c:206
format_rfc1123_time
void format_rfc1123_time(char *buf, time_t t)
Definition: time_fmt.c:182
tor_gmtime_r
struct tm * tor_gmtime_r(const time_t *timep, struct tm *result)
Definition: time_fmt.c:65
format_local_iso_time_nospace
void format_local_iso_time_nospace(char *buf, time_t t)
Definition: time_fmt.c:304
parse_iso_time
int parse_iso_time(const char *buf, time_t *t)
Definition: time_fmt.c:392
format_iso_time
void format_iso_time(char *buf, time_t t)
Definition: time_fmt.c:295
parse_iso_time_nospace
int parse_iso_time_nospace(const char *cp, time_t *t)
Definition: time_fmt.c:401
format_iso_time_nospace
void format_iso_time_nospace(char *buf, time_t t)
Definition: time_fmt.c:313
tor_localtime_r
struct tm * tor_localtime_r(const time_t *timep, struct tm *result)
Definition: time_fmt.c:46
parse_iso_time_
int parse_iso_time_(const char *cp, time_t *t, int strict, int nospace)
Definition: time_fmt.c:336
format_local_iso_time
void format_local_iso_time(char *buf, time_t t)
Definition: time_fmt.c:285
tor_timegm
int tor_timegm(const struct tm *tm, time_t *time_out)
Definition: time_fmt.c:96
timeval
Definition: compat_time.h:151
parse_http_time
int parse_http_time(const char *buf, struct tm *tm)
Definition: time_fmt.c:409