SquidTime.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 /* DEBUG: section 21 Time Functions */
10 
11 #ifndef SQUID_TIME_H
12 #define SQUID_TIME_H
13 
14 #include "rfc1123.h"
15 
16 #include <ctime>
17 /* NP: sys/time.h is provided by libcompat */
18 
19 /* Use uint64_t to store milliseconds */
20 typedef uint64_t time_msec_t;
21 
22 /* globals for accessing time */
23 extern struct timeval current_time;
24 extern double current_dtime;
25 extern time_t squid_curtime;
26 
27 time_t getCurrentTime(void);
28 int tvSubMsec(struct timeval, struct timeval);
29 
32 void tvSub(struct timeval &res, struct timeval const &t1, struct timeval const &t2);
33 
36 void tvAdd(struct timeval &res, struct timeval const &t1, struct timeval const &t2);
37 
40 void tvAssignAdd(struct timeval &t, struct timeval const &add);
41 
43 inline long int tvToMsec(struct timeval &t)
44 {
45  return t.tv_sec * 1000 + t.tv_usec / 1000;
46 }
47 
50 {
51 
52 public:
53  virtual ~TimeEngine();
54 
56  virtual void tick();
57 };
58 
59 namespace Time
60 {
61 
68 const char *FormatStrf(time_t t);
69 
76 const char *FormatHttpd(time_t t);
77 
78 } // namespace Time
79 
80 #endif /* SQUID_TIME_H */
81 
void tvAssignAdd(struct timeval &t, struct timeval const &add)
Definition: time.cc:62
time_t getCurrentTime(void)
Get current time.
const char * FormatStrf(time_t t)
Definition: stub_time.cc:24
virtual ~TimeEngine()
Definition: stub_time.cc:28
struct timeval current_time
Definition: stub_time.cc:15
time_t squid_curtime
Definition: stub_time.cc:17
int tvSubMsec(struct timeval, struct timeval)
Definition: stub_time.cc:20
uint64_t time_msec_t
Definition: SquidTime.h:20
void tvSub(struct timeval &res, struct timeval const &t1, struct timeval const &t2)
Definition: time.cc:41
long int tvToMsec(struct timeval &t)
Convert timeval to milliseconds.
Definition: SquidTime.h:43
const char * FormatHttpd(time_t t)
Definition: stub_time.cc:25
void tvAdd(struct timeval &res, struct timeval const &t1, struct timeval const &t2)
Definition: time.cc:52
double current_dtime
Definition: stub_time.cc:16
virtual void tick()
Definition: stub_time.cc:27

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors