From: Amos Jeffries Date: Wed, 13 Apr 2022 23:32:16 +0000 (+0000) Subject: SourceLayout: Move time related tools to time/libtime.la (#1001) X-Git-Tag: SQUID_6_0_1~208 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=98cacedb627d119bee7bfe89a1ae6cd7b53dfd75;p=thirdparty%2Fsquid.git SourceLayout: Move time related tools to time/libtime.la (#1001) Just code moves and documentation. Solves the occasional build issues of copying time.cc for linking to pinger and tools/ binaries. Which now link to the library. --- diff --git a/configure.ac b/configure.ac index 2eed09b008..d097afe0e7 100644 --- a/configure.ac +++ b/configure.ac @@ -3697,6 +3697,7 @@ AC_CONFIG_FILES([ src/store/Makefile src/store/id_rewriters/Makefile src/store/id_rewriters/file/Makefile + src/time/Makefile test-suite/Makefile tools/Makefile tools/apparmor/Makefile diff --git a/include/rfc1123.h b/include/rfc1123.h deleted file mode 100644 index 19e4c29342..0000000000 --- a/include/rfc1123.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 1996-2022 The Squid Software Foundation and contributors - * - * Squid software is distributed under GPLv2+ license and includes - * contributions from numerous individuals and organizations. - * Please see the COPYING and CONTRIBUTORS files for details. - */ - -#ifndef _SQUID_RFC1123_H -#define _SQUID_RFC1123_H - -#ifdef __cplusplus -extern "C" { -#endif - -extern const char *mkhttpdlogtime(const time_t *); -extern const char *mkrfc1123(time_t); -extern time_t parse_rfc1123(const char *str); - -#ifdef __cplusplus -} -#endif -#endif /* _SQUID_RFC1123_H */ - diff --git a/include/util.h b/include/util.h index af72febcc7..d64745fa51 100644 --- a/include/util.h +++ b/include/util.h @@ -9,19 +9,12 @@ #ifndef SQUID_UTIL_H #define SQUID_UTIL_H -#if HAVE_TIME_H -#include -#endif #if HAVE_ARPA_INET_H #include #endif -SQUIDCEXTERN int tvSubUsec(struct timeval, struct timeval); -SQUIDCEXTERN double tvSubDsec(struct timeval, struct timeval); SQUIDCEXTERN void Tolower(char *); -SQUIDCEXTERN time_t parse_iso3307_time(const char *buf); - SQUIDCEXTERN double xpercent(double part, double whole); SQUIDCEXTERN int xpercentInt(double part, double whole); SQUIDCEXTERN double xdiv(double nom, double denom); diff --git a/lib/Makefile.am b/lib/Makefile.am index b5bc65ef0a..d1fb753083 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -67,9 +67,7 @@ libmiscutil_la_SOURCES = \ Splay.cc \ getfullhostname.c \ heap.c \ - iso3307.c \ radix.c \ - rfc1123.c \ stub_memaccount.c \ util.c \ xusleep.c diff --git a/lib/util.c b/lib/util.c index 9213e892b8..7d8be0bcfe 100644 --- a/lib/util.c +++ b/lib/util.c @@ -35,20 +35,6 @@ Tolower(char *q) } } -int -tvSubUsec(struct timeval t1, struct timeval t2) -{ - return (t2.tv_sec - t1.tv_sec) * 1000000 + - (t2.tv_usec - t1.tv_usec); -} - -double -tvSubDsec(struct timeval t1, struct timeval t2) -{ - return (double) (t2.tv_sec - t1.tv_sec) + - (double) (t2.tv_usec - t1.tv_usec) / 1000000.0; -} - /* somewhat safer calculation of %s */ double xpercent(double part, double whole) diff --git a/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc b/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc index bdfe6d5ab4..8da369263c 100644 --- a/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc +++ b/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc @@ -18,7 +18,6 @@ #include "fd.h" #include "SquidConfig.h" #include "SquidIpc.h" -#include "SquidTime.h" #include "StatCounters.h" #include "Store.h" #include "unlinkd.h" diff --git a/src/DiskIO/DiskDaemon/Makefile.am b/src/DiskIO/DiskDaemon/Makefile.am index 283208de67..bf0531444d 100644 --- a/src/DiskIO/DiskDaemon/Makefile.am +++ b/src/DiskIO/DiskDaemon/Makefile.am @@ -23,15 +23,10 @@ libDiskDaemon_la_SOURCES = \ diomsg.h diskd_SOURCES = diskd.cc -nodist_diskd_SOURCES = time.cc diskd_LDADD = \ + $(top_builddir)/src/time/libtime.la \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ $(COMPAT_LIB) \ $(XTRA_LIBS) - -time.cc: $(top_srcdir)/src/time.cc - cp $(top_srcdir)/src/time.cc time.cc - -CLEANFILES += time.cc diff --git a/src/DiskIO/DiskFile.h b/src/DiskIO/DiskFile.h index 4976f797e4..65a821728d 100644 --- a/src/DiskIO/DiskFile.h +++ b/src/DiskIO/DiskFile.h @@ -10,7 +10,7 @@ #define SQUID_DISKFILE_H #include "base/RefCount.h" -#include "SquidTime.h" +#include "time/gadgets.h" class IORequestor; diff --git a/src/DiskIO/DiskThreads/aiops.cc b/src/DiskIO/DiskThreads/aiops.cc index 58c4dd7d74..d979cb260b 100644 --- a/src/DiskIO/DiskThreads/aiops.cc +++ b/src/DiskIO/DiskThreads/aiops.cc @@ -16,7 +16,6 @@ #include "DiskIO/DiskThreads/CommIO.h" #include "DiskThreads.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" /* diff --git a/src/DiskIO/DiskThreads/aiops_win32.cc b/src/DiskIO/DiskThreads/aiops_win32.cc index 9e30898e6e..a03bec906b 100644 --- a/src/DiskIO/DiskThreads/aiops_win32.cc +++ b/src/DiskIO/DiskThreads/aiops_win32.cc @@ -14,7 +14,6 @@ #include "fd.h" #include "mem/Pool.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" #include diff --git a/src/DiskIO/IpcIo/IpcIoFile.cc b/src/DiskIO/IpcIo/IpcIoFile.cc index e9f54a3a25..c769a283ec 100644 --- a/src/DiskIO/IpcIo/IpcIoFile.cc +++ b/src/DiskIO/IpcIo/IpcIoFile.cc @@ -29,7 +29,6 @@ #include "ipc/UdsOp.h" #include "sbuf/SBuf.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "StatCounters.h" #include "tools.h" diff --git a/src/EventLoop.cc b/src/EventLoop.cc index 967726d129..4ee03c1aa2 100644 --- a/src/EventLoop.cc +++ b/src/EventLoop.cc @@ -14,7 +14,7 @@ #include "debug/Stream.h" #include "EventLoop.h" #include "fatal.h" -#include "SquidTime.h" +#include "time/Engine.h" EventLoop *EventLoop::Running = NULL; @@ -159,7 +159,7 @@ EventLoop::setPrimaryEngine(AsyncEngine * engine) } void -EventLoop::setTimeService(TimeEngine *engine) +EventLoop::setTimeService(Time::Engine *engine) { timeService = engine; } diff --git a/src/EventLoop.h b/src/EventLoop.h index ad9081adfe..5150db4324 100644 --- a/src/EventLoop.h +++ b/src/EventLoop.h @@ -9,12 +9,13 @@ #ifndef SQUID_EVENTLOOP_H #define SQUID_EVENTLOOP_H +#include "time/forward.h" + #include #define EVENT_LOOP_TIMEOUT 1000 /* 1s timeout */ class AsyncEngine; -class TimeEngine; /** An event loop. An event loop is the core inner loop of squid. * The event loop can be run until exit, or once. After it finishes control @@ -58,7 +59,7 @@ public: /** set the time service. There can be only one time service set at any * time. The time service is invoked on each loop */ - void setTimeService(TimeEngine *engine); + void setTimeService(Time::Engine *); /** stop the event loop - it will finish the current loop and then return to the * caller of run(). @@ -84,7 +85,7 @@ private: bool last_loop; typedef std::vector engine_vector; engine_vector engines; - TimeEngine * timeService; + Time::Engine *timeService; AsyncEngine * primaryEngine; int loop_delay; /**< the delay to be given to the primary engine */ bool error; /**< has an error occurred in this loop */ diff --git a/src/ExternalACLEntry.cc b/src/ExternalACLEntry.cc index 9417edea4a..d12550ea50 100644 --- a/src/ExternalACLEntry.cc +++ b/src/ExternalACLEntry.cc @@ -10,7 +10,7 @@ #include "squid.h" #include "ExternalACLEntry.h" -#include "SquidTime.h" +#include "time/gadgets.h" /****************************************************************** * external_acl cache diff --git a/src/FadingCounter.cc b/src/FadingCounter.cc index 687ef82c01..54f9fa5a3e 100644 --- a/src/FadingCounter.cc +++ b/src/FadingCounter.cc @@ -10,7 +10,7 @@ #include "base/TextException.h" #include "debug/Stream.h" #include "FadingCounter.h" -#include "SquidTime.h" +#include "time/gadgets.h" #include diff --git a/src/FwdState.cc b/src/FwdState.cc index 6448595493..826c0e34b6 100644 --- a/src/FwdState.cc +++ b/src/FwdState.cc @@ -50,7 +50,6 @@ #include "ResolvedPeers.h" #include "security/BlindPeerConnector.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "ssl/PeekingPeerConnector.h" #include "Store.h" #include "StoreClient.h" diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index 318af12069..1a69b6b2ab 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -25,13 +25,13 @@ #include "MemBuf.h" #include "mgr/Registration.h" #include "mime_header.h" -#include "rfc1123.h" #include "sbuf/StringConvert.h" #include "SquidConfig.h" #include "StatHist.h" #include "Store.h" #include "StrList.h" #include "TimeOrTag.h" +#include "time/gadgets.h" #include "util.h" #include @@ -1045,7 +1045,7 @@ HttpHeader::putTime(Http::HdrType id, time_t htime) assert(any_registered_header(id)); assert(Http::HeaderLookupTable.lookup(id).type == Http::HdrFieldType::ftDate_1123); /* must be of an appropriate type */ assert(htime >= 0); - addEntry(new HttpHeaderEntry(id, SBuf(), mkrfc1123(htime))); + addEntry(new HttpHeaderEntry(id, SBuf(), Time::FormatRfc1123(htime))); } void @@ -1180,7 +1180,7 @@ HttpHeader::getTime(Http::HdrType id) const assert(Http::HeaderLookupTable.lookup(id).type == Http::HdrFieldType::ftDate_1123); /* must be of an appropriate type */ if ((e = findEntry(id))) { - value = parse_rfc1123(e->value.termedBuf()); + value = Time::ParseRfc1123(e->value.termedBuf()); httpHeaderNoteParsedEntry(e->id, e->value, value < 0); } @@ -1372,7 +1372,7 @@ HttpHeader::getTimeOrTag(Http::HdrType id) const tot.time = -1; } else { /* or maybe it is time? */ - tot.time = parse_rfc1123(str); + tot.time = Time::ParseRfc1123(str); tot.valid = tot.time >= 0; tot.tag.str = NULL; } diff --git a/src/HttpReply.cc b/src/HttpReply.cc index 2c34f9f7ed..d3fa3217fd 100644 --- a/src/HttpReply.cc +++ b/src/HttpReply.cc @@ -22,7 +22,6 @@ #include "HttpRequest.h" #include "MemBuf.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" #include "StrList.h" @@ -645,7 +644,7 @@ String HttpReply::removeStaleWarningValues(const String &value) // found warn-text String warnDate; warnDate.append(warnDateBeg, warnDateEnd - warnDateBeg); - const time_t time = parse_rfc1123(warnDate.termedBuf()); + const time_t time = Time::ParseRfc1123(warnDate.termedBuf()); keep = (time > 0 && time == date); // keep valid and matching date } } diff --git a/src/Makefile.am b/src/Makefile.am index 589d5ac9cf..56af821837 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -31,8 +31,8 @@ LOADABLE_MODULES_SOURCES = \ LoadableModules.cc \ LoadableModules.h -SUBDIRS = mem debug base anyp helper dns ftp parser comm error eui acl format clients sbuf servers fs repl store DiskIO proxyp -DIST_SUBDIRS = mem debug base anyp helper dns ftp parser comm error eui acl format clients sbuf servers fs repl store DiskIO proxyp +SUBDIRS = mem time debug base anyp helper dns ftp parser comm error eui acl format clients sbuf servers fs repl store DiskIO proxyp +DIST_SUBDIRS = mem time debug base anyp helper dns ftp parser comm error eui acl format clients sbuf servers fs repl store DiskIO proxyp if ENABLE_AUTH SUBDIRS += auth @@ -455,7 +455,6 @@ squid_SOURCES = \ store_swapmeta.cc \ store_swapout.cc \ swap_log_op.h \ - time.cc \ tools.cc \ tools.h \ tunnel.cc \ @@ -487,8 +486,7 @@ EXTRA_squid_SOURCES = \ noinst_HEADERS = \ MemBuf.h \ - SquidString.h \ - SquidTime.h + SquidString.h BUILT_SOURCES = \ cf_gen_defines.cci \ @@ -548,6 +546,7 @@ squid_LDADD = \ $(SNMP_LIBS) \ mem/libmem.la \ store/libstore.la \ + time/libtime.la \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ @@ -802,7 +801,7 @@ tests_testMem_SOURCES = \ tests/testMem.cc \ tests/testMem.h nodist_tests_testMem_SOURCES = \ - tests/stub_time.cc + tests/stub_libtime.cc tests_testMem_LDADD = \ mem/libmem.la \ $(top_builddir)/lib/libmiscutil.la \ @@ -1126,7 +1125,6 @@ tests_testRock_SOURCES = \ tests/stub_store_stats.cc \ store_swapmeta.cc \ store_swapout.cc \ - time.cc \ tests/stub_tools.cc \ tools.h \ wordlist.cc \ @@ -1159,6 +1157,7 @@ tests_testRock_LDADD = \ store/libstore.la \ $(ADAPTATION_LIBS) \ sbuf/libsbuf.la \ + time/libtime.la \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ @@ -1304,7 +1303,6 @@ tests_testUfs_SOURCES = \ tests/stub_store_stats.cc \ store_swapmeta.cc \ store_swapout.cc \ - time.cc \ tests/stub_tools.cc \ tools.h \ wordlist.cc \ @@ -1342,6 +1340,7 @@ tests_testUfs_LDADD = \ store/libstore.la \ $(ADAPTATION_LIBS) \ sbuf/libsbuf.la \ + time/libtime.la \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ @@ -1481,7 +1480,6 @@ tests_testStore_SOURCES = \ tests/CapturingStoreEntry.h \ tests/TestSwapDir.cc \ tests/TestSwapDir.h \ - tests/stub_time.cc \ tests/stub_tools.cc \ tools.h \ wordlist.cc \ @@ -1490,6 +1488,7 @@ nodist_tests_testStore_SOURCES = \ $(TESTSOURCES) \ SquidMath.cc \ SquidMath.h \ + tests/stub_libtime.cc \ swap_log_op.cc tests_testStore_LDADD= \ libsquid.la \ @@ -1655,7 +1654,6 @@ tests_testDiskIO_SOURCES = \ tests/stub_store_stats.cc \ store_swapmeta.cc \ store_swapout.cc \ - tests/stub_time.cc \ tests/stub_tools.cc \ tools.h \ wordlist.cc \ @@ -1665,6 +1663,7 @@ nodist_tests_testDiskIO_SOURCES = \ SquidMath.cc \ SquidMath.h \ hier_code.cc \ + tests/stub_libtime.cc \ swap_log_op.cc tests_testDiskIO_LDADD = \ libsquid.la \ @@ -1931,7 +1930,6 @@ tests_test_http_range_SOURCES = \ store_swapin.h \ store_swapmeta.cc \ store_swapout.cc \ - time.cc \ tools.cc \ tools.h \ tests/stub_tunnel.cc \ @@ -1945,7 +1943,8 @@ tests_test_http_range_SOURCES = \ wordlist.cc \ wordlist.h nodist_tests_test_http_range_SOURCES = \ - $(BUILT_SOURCES) + $(BUILT_SOURCES) \ + tests/stub_libtime.cc tests_test_http_range_LDADD = \ libsquid.la \ clients/libclients.la \ @@ -2016,13 +2015,13 @@ tests_testHttp1Parser_SOURCES = \ tests/stub_stmem.cc \ tests/stub_store.cc \ tests/stub_store_stats.cc \ - tests/stub_time.cc \ tests/stub_tools.cc \ tools.h \ wordlist.cc \ wordlist.h nodist_tests_testHttp1Parser_SOURCES = \ - $(TESTSOURCES) + $(TESTSOURCES) \ + tests/stub_libtime.cc tests_testHttp1Parser_LDADD= \ http/libhttp.la \ parser/libparser.la \ @@ -2075,7 +2074,6 @@ tests_testHttpReply_SOURCES = \ Notes.cc \ Notes.h \ SquidString.h \ - SquidTime.h \ StatCounters.cc \ StatCounters.h \ tests/stub_StatHist.cc \ @@ -2111,14 +2109,14 @@ tests_testHttpReply_SOURCES = \ repl_modules.h \ tests/stub_store.cc \ tests/stub_store_stats.cc \ - tests/stub_time.cc \ tests/stub_tools.cc \ tools.h \ wordlist.cc \ wordlist.h nodist_tests_testHttpReply_SOURCES = \ $(TESTSOURCES) \ - hier_code.cc + hier_code.cc \ + tests/stub_libtime.cc tests_testHttpReply_LDADD=\ CommCalls.o \ http/libhttp.la \ @@ -2321,7 +2319,6 @@ tests_testHttpRequest_SOURCES = \ store_swapin.h \ store_swapmeta.cc \ store_swapout.cc \ - time.cc \ tools.cc \ tools.h \ tests/stub_tunnel.cc \ @@ -2335,7 +2332,8 @@ tests_testHttpRequest_SOURCES = \ wordlist.cc \ wordlist.h nodist_tests_testHttpRequest_SOURCES = \ - $(BUILT_SOURCES) + $(BUILT_SOURCES) \ + tests/stub_libtime.cc tests_testHttpRequest_LDADD = \ libsquid.la \ clients/libclients.la \ @@ -2410,11 +2408,10 @@ tests_testIcmp_SOURCES = \ tests/testIcmp.h nodist_tests_testIcmp_SOURCES = \ tests/stub_SBuf.cc \ - SquidTime.h \ tests/stub_debug.cc \ icmp/Icmp.h \ tests/stub_libmem.cc \ - time.cc + tests/stub_libtime.cc tests_testIcmp_LDADD=\ icmp/libicmpcore.la \ ip/libip.la \ @@ -2430,10 +2427,9 @@ tests_testNetDb_SOURCES = \ tests/testNetDb.h nodist_tests_testNetDb_SOURCES = \ tests/stub_SBuf.cc \ - SquidTime.h \ tests/stub_debug.cc \ tests/stub_libmem.cc \ - time.cc + tests/stub_libtime.cc tests_testNetDb_LDADD = \ icmp/libicmp.la \ ip/libip.la \ @@ -2624,7 +2620,6 @@ tests_testCacheManager_SOURCES = \ store_swapin.h \ store_swapmeta.cc \ store_swapout.cc \ - time.cc \ tools.cc \ tools.h \ tests/stub_tunnel.cc \ @@ -2638,7 +2633,8 @@ tests_testCacheManager_SOURCES = \ wordlist.cc \ wordlist.h nodist_tests_testCacheManager_SOURCES = \ - $(BUILT_SOURCES) + $(BUILT_SOURCES) \ + tests/stub_libtime.cc # comm.cc only requires comm/libcomm.la until fdc_table is dead. tests_testCacheManager_LDADD = \ libsquid.la \ @@ -2712,11 +2708,11 @@ tests_testStatHist_SOURCES = \ tests/stub_stmem.cc \ tests/stub_store.cc \ tests/stub_store_stats.cc \ - time.cc \ tests/stub_tools.cc \ tools.h nodist_tests_testStatHist_SOURCES = \ - $(TESTSOURCES) + $(TESTSOURCES) \ + tests/stub_libtime.cc tests_testStatHist_LDADD = \ sbuf/libsbuf.la \ base/libbase.la \ @@ -2762,7 +2758,7 @@ nodist_tests_testEvent_SOURCES = \ tests/stub_debug.cc \ event.cc \ tests/stub_libmem.cc \ - tests/stub_time.cc \ + tests/stub_libtime.cc \ tests/stub_tools.cc tests_testEvent_LDADD = \ base/libbase.la \ @@ -2779,7 +2775,7 @@ nodist_tests_testEventLoop_SOURCES = \ EventLoop.cc \ tests/stub_debug.cc \ tests/stub_fatal.cc \ - tests/stub_time.cc + tests/stub_libtime.cc tests_testEventLoop_LDADD = \ base/libbase.la \ $(LIBCPPUNIT_LIBS) \ diff --git a/src/MessageDelayPools.cc b/src/MessageDelayPools.cc index 8258c6e77d..8d06f5db9f 100644 --- a/src/MessageDelayPools.cc +++ b/src/MessageDelayPools.cc @@ -17,7 +17,6 @@ #include "MessageBucket.h" #include "MessageDelayPools.h" #include "Parsing.h" -#include "SquidTime.h" #include "Store.h" #include diff --git a/src/PeerPoolMgr.cc b/src/PeerPoolMgr.cc index 252a259dd2..60d7343f40 100644 --- a/src/PeerPoolMgr.cc +++ b/src/PeerPoolMgr.cc @@ -24,7 +24,6 @@ #include "PeerPoolMgr.h" #include "security/BlindPeerConnector.h" #include "SquidConfig.h" -#include "SquidTime.h" CBDATA_CLASS_INIT(PeerPoolMgr); diff --git a/src/SquidConfig.h b/src/SquidConfig.h index f13ff835fb..c70d9ed3e6 100644 --- a/src/SquidConfig.h +++ b/src/SquidConfig.h @@ -24,12 +24,12 @@ #endif #include "Notes.h" #include "security/forward.h" -#include "SquidTime.h" #if USE_OPENSSL #include "ssl/support.h" #endif #include "store/Disk.h" #include "store/forward.h" +#include "time/gadgets.h" #include diff --git a/src/acl/Time.cc b/src/acl/Time.cc index 828aeb76a4..2351c7ed3e 100644 --- a/src/acl/Time.cc +++ b/src/acl/Time.cc @@ -11,7 +11,6 @@ #include "squid.h" #include "acl/Time.h" #include "acl/TimeData.h" -#include "SquidTime.h" int ACLTimeStrategy::match(ACLData * &data, ACLFilledChecklist *) diff --git a/src/acl/external/kerberos_ldap_group/support_krb5.cc b/src/acl/external/kerberos_ldap_group/support_krb5.cc index a0e76cc0c1..dc51552c29 100644 --- a/src/acl/external/kerberos_ldap_group/support_krb5.cc +++ b/src/acl/external/kerberos_ldap_group/support_krb5.cc @@ -31,7 +31,8 @@ */ #include "squid.h" -#include "util.h" + +#include #if HAVE_LDAP && HAVE_KRB5 diff --git a/src/adaptation/History.cc b/src/adaptation/History.cc index e5f4be2b44..6dc8bd685d 100644 --- a/src/adaptation/History.cc +++ b/src/adaptation/History.cc @@ -13,7 +13,7 @@ #include "base/TextException.h" #include "debug/Stream.h" #include "globals.h" -#include "SquidTime.h" +#include "time/gadgets.h" /// impossible services value to identify unset theNextServices const static char *TheNullServices = ",null,"; diff --git a/src/adaptation/ecap/XactionRep.cc b/src/adaptation/ecap/XactionRep.cc index 8a5edc89c4..b45b671bc5 100644 --- a/src/adaptation/ecap/XactionRep.cc +++ b/src/adaptation/ecap/XactionRep.cc @@ -24,7 +24,6 @@ #include "HttpReply.h" #include "HttpRequest.h" #include "MasterXaction.h" -#include "SquidTime.h" CBDATA_NAMESPACED_CLASS_INIT(Adaptation::Ecap::XactionRep, XactionRep); diff --git a/src/adaptation/icap/History.cc b/src/adaptation/icap/History.cc index f70275fd0b..de6191409e 100644 --- a/src/adaptation/icap/History.cc +++ b/src/adaptation/icap/History.cc @@ -10,7 +10,7 @@ #include "adaptation/icap/History.h" #include "debug/Stream.h" #include "globals.h" -#include "SquidTime.h" +#include "time/gadgets.h" Adaptation::Icap::History::History(): req_sz(0), diff --git a/src/adaptation/icap/ModXact.cc b/src/adaptation/icap/ModXact.cc index e62d2c3c49..ede6822c40 100644 --- a/src/adaptation/icap/ModXact.cc +++ b/src/adaptation/icap/ModXact.cc @@ -32,7 +32,6 @@ #include "MasterXaction.h" #include "parser/Tokenizer.h" #include "sbuf/Stream.h" -#include "SquidTime.h" // flow and terminology: // HTTP| --> receive --> encode --> write --> |network @@ -1389,7 +1388,7 @@ void Adaptation::Icap::ModXact::makeRequestHeaders(MemBuf &buf) const Adaptation::ServiceConfig &s = service().cfg(); buf.appendf("%s " SQUIDSTRINGPH " ICAP/1.0\r\n", s.methodStr(), SQUIDSTRINGPRINT(s.uri)); buf.appendf("Host: " SQUIDSTRINGPH ":%d\r\n", SQUIDSTRINGPRINT(s.host), s.port); - buf.appendf("Date: %s\r\n", mkrfc1123(squid_curtime)); + buf.appendf("Date: %s\r\n", Time::FormatRfc1123(squid_curtime)); if (!TheConfig.reuse_connections) buf.appendf("Connection: close\r\n"); diff --git a/src/adaptation/icap/OptXact.cc b/src/adaptation/icap/OptXact.cc index 0e36bfce58..42531b97e6 100644 --- a/src/adaptation/icap/OptXact.cc +++ b/src/adaptation/icap/OptXact.cc @@ -18,7 +18,6 @@ #include "HttpHeaderTools.h" #include "HttpReply.h" #include "HttpRequest.h" -#include "SquidTime.h" CBDATA_NAMESPACED_CLASS_INIT(Adaptation::Icap, OptXact); CBDATA_NAMESPACED_CLASS_INIT(Adaptation::Icap, OptXactLauncher); diff --git a/src/adaptation/icap/Options.cc b/src/adaptation/icap/Options.cc index 0bbbc6c227..1544ebf76a 100644 --- a/src/adaptation/icap/Options.cc +++ b/src/adaptation/icap/Options.cc @@ -11,7 +11,6 @@ #include "adaptation/icap/Options.h" #include "base/TextException.h" #include "HttpReply.h" -#include "SquidTime.h" #include "StrList.h" #include "wordlist.h" diff --git a/src/adaptation/icap/ServiceRep.cc b/src/adaptation/icap/ServiceRep.cc index 8ef224dc11..ed12f4b7de 100644 --- a/src/adaptation/icap/ServiceRep.cc +++ b/src/adaptation/icap/ServiceRep.cc @@ -24,7 +24,6 @@ #include "HttpReply.h" #include "ip/tools.h" #include "SquidConfig.h" -#include "SquidTime.h" #define DEFAULT_ICAP_PORT 1344 #define DEFAULT_ICAPS_PORT 11344 diff --git a/src/adaptation/icap/Xaction.cc b/src/adaptation/icap/Xaction.cc index a91d0c56ea..499c618dd0 100644 --- a/src/adaptation/icap/Xaction.cc +++ b/src/adaptation/icap/Xaction.cc @@ -31,7 +31,6 @@ #include "pconn.h" #include "security/PeerConnector.h" #include "SquidConfig.h" -#include "SquidTime.h" /// Gives Security::PeerConnector access to Answer in the PeerPoolMgr callback dialer. class MyIcapAnswerDialer: public UnaryMemFunT, diff --git a/src/auth/User.cc b/src/auth/User.cc index a1a429bf14..0ba33d3ed8 100644 --- a/src/auth/User.cc +++ b/src/auth/User.cc @@ -18,7 +18,6 @@ #include "auth/UserRequest.h" #include "event.h" #include "globals.h" -#include "SquidTime.h" #include "Store.h" Auth::User::User(Auth::SchemeConfig *aConfig, const char *aRequestRealm) : diff --git a/src/auth/basic/Config.cc b/src/auth/basic/Config.cc index 485d99d72a..8f46cc4fdc 100644 --- a/src/auth/basic/Config.cc +++ b/src/auth/basic/Config.cc @@ -29,7 +29,6 @@ #include "mgr/Registration.h" #include "rfc1738.h" #include "sbuf/SBuf.h" -#include "SquidTime.h" #include "Store.h" #include "util.h" #include "wordlist.h" diff --git a/src/auth/basic/UserRequest.cc b/src/auth/basic/UserRequest.cc index a384a3faf6..b1b037d06f 100644 --- a/src/auth/basic/UserRequest.cc +++ b/src/auth/basic/UserRequest.cc @@ -19,7 +19,6 @@ #include "HttpRequest.h" #include "MemBuf.h" #include "rfc1738.h" -#include "SquidTime.h" #if !defined(HELPER_INPUT_BUFFER) #define HELPER_INPUT_BUFFER 8192 diff --git a/src/auth/digest/Config.cc b/src/auth/digest/Config.cc index c785bc3cb9..158876cfaf 100644 --- a/src/auth/digest/Config.cc +++ b/src/auth/digest/Config.cc @@ -33,7 +33,6 @@ #include "rfc2617.h" #include "sbuf/SBuf.h" #include "sbuf/StringConvert.h" -#include "SquidTime.h" #include "Store.h" #include "StrList.h" #include "wordlist.h" diff --git a/src/auth/digest/UserRequest.cc b/src/auth/digest/UserRequest.cc index 81cae2ffb1..14951f34e2 100644 --- a/src/auth/digest/UserRequest.cc +++ b/src/auth/digest/UserRequest.cc @@ -19,7 +19,6 @@ #include "HttpReply.h" #include "HttpRequest.h" #include "MemBuf.h" -#include "SquidTime.h" Auth::Digest::UserRequest::UserRequest() : noncehex(NULL), diff --git a/src/auth/negotiate/Config.cc b/src/auth/negotiate/Config.cc index b1756730e1..e8c5915d8b 100644 --- a/src/auth/negotiate/Config.cc +++ b/src/auth/negotiate/Config.cc @@ -27,7 +27,6 @@ #include "HttpReply.h" #include "HttpRequest.h" #include "mgr/Registration.h" -#include "SquidTime.h" #include "Store.h" #include "wordlist.h" diff --git a/src/auth/negotiate/UserRequest.cc b/src/auth/negotiate/UserRequest.cc index e02fe56d47..f56c4d74a1 100644 --- a/src/auth/negotiate/UserRequest.cc +++ b/src/auth/negotiate/UserRequest.cc @@ -25,7 +25,6 @@ #include "HttpReply.h" #include "HttpRequest.h" #include "MemBuf.h" -#include "SquidTime.h" Auth::Negotiate::UserRequest::UserRequest() : server_blob(nullptr), diff --git a/src/auth/ntlm/Config.cc b/src/auth/ntlm/Config.cc index 4ad5f68418..d30d518588 100644 --- a/src/auth/ntlm/Config.cc +++ b/src/auth/ntlm/Config.cc @@ -27,7 +27,6 @@ #include "HttpReply.h" #include "HttpRequest.h" #include "mgr/Registration.h" -#include "SquidTime.h" #include "Store.h" #include "wordlist.h" diff --git a/src/auth/ntlm/UserRequest.cc b/src/auth/ntlm/UserRequest.cc index a41a48af25..4445f0174a 100644 --- a/src/auth/ntlm/UserRequest.cc +++ b/src/auth/ntlm/UserRequest.cc @@ -23,7 +23,6 @@ #include "http/Stream.h" #include "HttpRequest.h" #include "MemBuf.h" -#include "SquidTime.h" Auth::Ntlm::UserRequest::UserRequest() : server_blob(nullptr), diff --git a/src/base/ClpMap.h b/src/base/ClpMap.h index cb3d2229ee..f8c6200b8c 100644 --- a/src/base/ClpMap.h +++ b/src/base/ClpMap.h @@ -12,7 +12,7 @@ #include "base/Optional.h" #include "mem/PoolingAllocator.h" #include "SquidMath.h" -#include "SquidTime.h" +#include "time/gadgets.h" #include #include diff --git a/src/cache_manager.cc b/src/cache_manager.cc index 4a2f30b191..4c053aa3f4 100644 --- a/src/cache_manager.cc +++ b/src/cache_manager.cc @@ -33,7 +33,6 @@ #include "sbuf/Stream.h" #include "sbuf/StringConvert.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" #include "tools.h" #include "wordlist.h" diff --git a/src/client_db.cc b/src/client_db.cc index a8bf0a7b22..8016fbab3e 100644 --- a/src/client_db.cc +++ b/src/client_db.cc @@ -20,7 +20,6 @@ #include "mgr/Registration.h" #include "SquidConfig.h" #include "SquidMath.h" -#include "SquidTime.h" #include "StatCounters.h" #include "Store.h" #include "tools.h" diff --git a/src/client_side.cc b/src/client_side.cc index f6c04d16a2..16dc4b449d 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -113,7 +113,6 @@ #include "security/NegotiationHistory.h" #include "servers/forward.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "StatCounters.h" #include "StatHist.h" #include "Store.h" @@ -137,9 +136,6 @@ #include "ssl/support.h" #endif -// for tvSubUsec() which should be in SquidTime.h -#include "util.h" - #include #include #include diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index f35c1cc117..ca6334ac8e 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -33,7 +33,6 @@ #include "refresh.h" #include "RequestFlags.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" #include "StrList.h" #include "tools.h" diff --git a/src/client_side_request.cc b/src/client_side_request.cc index bbdd45ac64..e7e6cd0131 100644 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@ -53,7 +53,6 @@ #include "rfc1738.h" #include "sbuf/StringConvert.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" #include "StrList.h" #include "tools.h" diff --git a/src/clients/Client.cc b/src/clients/Client.cc index 30ad799d6a..530dbbabc4 100644 --- a/src/clients/Client.cc +++ b/src/clients/Client.cc @@ -21,7 +21,6 @@ #include "HttpReply.h" #include "HttpRequest.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "StatCounters.h" #include "Store.h" #include "tools.h" diff --git a/src/clients/FtpGateway.cc b/src/clients/FtpGateway.cc index ae18fe2c29..395ec6765e 100644 --- a/src/clients/FtpGateway.cc +++ b/src/clients/FtpGateway.cc @@ -34,7 +34,6 @@ #include "rfc1738.h" #include "SquidConfig.h" #include "SquidString.h" -#include "SquidTime.h" #include "StatCounters.h" #include "Store.h" #include "tools.h" @@ -1580,7 +1579,7 @@ ftpReadMdtm(Ftp::Gateway * ftpState) debugs(9, 3, MYNAME); if (code == 213) { - ftpState->mdtm = parse_iso3307_time(ftpState->ctrl.last_reply); + ftpState->mdtm = Time::ParseIso3307(ftpState->ctrl.last_reply); ftpState->unhack(); } else if (code < 0) { ftpFail(ftpState); diff --git a/src/clients/FtpRelay.cc b/src/clients/FtpRelay.cc index 768fbce710..9b0d7fbd6a 100644 --- a/src/clients/FtpRelay.cc +++ b/src/clients/FtpRelay.cc @@ -22,7 +22,6 @@ #include "HttpRequest.h" #include "sbuf/SBuf.h" #include "servers/FtpServer.h" -#include "SquidTime.h" #include "Store.h" #include "wordlist.h" diff --git a/src/comm/ConnOpener.cc b/src/comm/ConnOpener.cc index da709976fa..e705cb16aa 100644 --- a/src/comm/ConnOpener.cc +++ b/src/comm/ConnOpener.cc @@ -22,7 +22,6 @@ #include "ip/tools.h" #include "ipcache.h" #include "SquidConfig.h" -#include "SquidTime.h" #include diff --git a/src/comm/Connection.cc b/src/comm/Connection.cc index 517831ecf8..2e2f1d7052 100644 --- a/src/comm/Connection.cc +++ b/src/comm/Connection.cc @@ -17,7 +17,7 @@ #include "neighbors.h" #include "security/NegotiationHistory.h" #include "SquidConfig.h" -#include "SquidTime.h" + #include InstanceIdDefinitions(Comm::Connection, "conn", uint64_t); diff --git a/src/comm/Connection.h b/src/comm/Connection.h index 2d3ce32ea1..d4672b6903 100644 --- a/src/comm/Connection.h +++ b/src/comm/Connection.h @@ -23,7 +23,7 @@ #include "ip/Address.h" #include "ip/forward.h" #include "mem/forward.h" -#include "SquidTime.h" +#include "time/gadgets.h" #include #include diff --git a/src/comm/ModDevPoll.cc b/src/comm/ModDevPoll.cc index 3031acb1ef..dbad789a6a 100644 --- a/src/comm/ModDevPoll.cc +++ b/src/comm/ModDevPoll.cc @@ -35,7 +35,6 @@ #include "fd.h" #include "fde.h" #include "mgr/Registration.h" -#include "SquidTime.h" #include "StatCounters.h" #include "StatHist.h" #include "Store.h" diff --git a/src/comm/ModEpoll.cc b/src/comm/ModEpoll.cc index 46bb7b3c83..4b13050455 100644 --- a/src/comm/ModEpoll.cc +++ b/src/comm/ModEpoll.cc @@ -37,7 +37,6 @@ #include "fde.h" #include "globals.h" #include "mgr/Registration.h" -#include "SquidTime.h" #include "StatCounters.h" #include "StatHist.h" #include "Store.h" diff --git a/src/comm/ModKqueue.cc b/src/comm/ModKqueue.cc index 38dd4da009..694eb3e3dc 100644 --- a/src/comm/ModKqueue.cc +++ b/src/comm/ModKqueue.cc @@ -35,7 +35,6 @@ #include "comm/Loops.h" #include "fde.h" #include "globals.h" -#include "SquidTime.h" #include "StatCounters.h" #include "Store.h" diff --git a/src/comm/ModPoll.cc b/src/comm/ModPoll.cc index 113f9e59f9..2b659890b7 100644 --- a/src/comm/ModPoll.cc +++ b/src/comm/ModPoll.cc @@ -20,7 +20,6 @@ #include "ICP.h" #include "mgr/Registration.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "StatCounters.h" #include "Store.h" diff --git a/src/comm/ModSelect.cc b/src/comm/ModSelect.cc index 7c4d80b71b..b5fc8ef0de 100644 --- a/src/comm/ModSelect.cc +++ b/src/comm/ModSelect.cc @@ -20,7 +20,6 @@ #include "ICP.h" #include "mgr/Registration.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "StatCounters.h" #include "StatHist.h" #include "Store.h" diff --git a/src/comm/ModSelectWin32.cc b/src/comm/ModSelectWin32.cc index 8a501d55af..6becb3d11b 100644 --- a/src/comm/ModSelectWin32.cc +++ b/src/comm/ModSelectWin32.cc @@ -17,7 +17,6 @@ #include "fde.h" #include "ICP.h" #include "mgr/Registration.h" -#include "SquidTime.h" #include "StatCounters.h" #include "StatHist.h" #include "Store.h" diff --git a/src/comm/TcpAcceptor.cc b/src/comm/TcpAcceptor.cc index b27f0ac96b..b93991ef8b 100644 --- a/src/comm/TcpAcceptor.cc +++ b/src/comm/TcpAcceptor.cc @@ -28,7 +28,6 @@ #include "log/access_log.h" #include "MasterXaction.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "StatCounters.h" #include diff --git a/src/comm/Write.cc b/src/comm/Write.cc index aeee04db98..436847ca77 100644 --- a/src/comm/Write.cc +++ b/src/comm/Write.cc @@ -16,7 +16,6 @@ #include "fde.h" #include "globals.h" #include "MemBuf.h" -#include "SquidTime.h" #include "StatCounters.h" #if USE_DELAY_POOLS #include "ClientInfo.h" diff --git a/src/debug/debug.cc b/src/debug/debug.cc index 10508ca669..bc466a3196 100644 --- a/src/debug/debug.cc +++ b/src/debug/debug.cc @@ -14,7 +14,7 @@ #include "debug/Stream.h" #include "fd.h" #include "ipc/Kids.h" -#include "SquidTime.h" +#include "time/gadgets.h" #include "util.h" #include diff --git a/src/delay_pools.cc b/src/delay_pools.cc index d27fefc1b8..457847a469 100644 --- a/src/delay_pools.cc +++ b/src/delay_pools.cc @@ -36,7 +36,6 @@ #include "mgr/Registration.h" #include "NullDelayId.h" #include "SquidString.h" -#include "SquidTime.h" #include "Store.h" #include "StoreClient.h" diff --git a/src/dns_internal.cc b/src/dns_internal.cc index a36579397b..a4dbf2be51 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -30,7 +30,6 @@ #include "mgr/Registration.h" #include "snmp_agent.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" #include "tools.h" #include "util.h" diff --git a/src/errorpage.cc b/src/errorpage.cc index 3b9de53ed8..662ec85973 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -29,7 +29,6 @@ #include "rfc1738.h" #include "sbuf/Stream.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" #include "tools.h" #include "wordlist.h" @@ -834,7 +833,7 @@ ErrorState::Dump(MemBuf * mb) str.appendf("DNS ErrMsg: %s\r\n", dnsError.termedBuf()); /* - TimeStamp */ - str.appendf("TimeStamp: %s\r\n\r\n", mkrfc1123(squid_curtime)); + str.appendf("TimeStamp: %s\r\n\r\n", Time::FormatRfc1123(squid_curtime)); /* - IP stuff */ str.appendf("ClientIP: %s\r\n", src_addr.toStr(ntoabuf,MAX_IPSTRLEN)); @@ -1165,7 +1164,7 @@ ErrorState::compileLegacyCode(Build &build) break; case 'T': - mb.appendf("%s", mkrfc1123(squid_curtime)); + mb.appendf("%s", Time::FormatRfc1123(squid_curtime)); break; case 'U': diff --git a/src/event.cc b/src/event.cc index a344b12f49..dcaed3188e 100644 --- a/src/event.cc +++ b/src/event.cc @@ -11,7 +11,6 @@ #include "squid.h" #include "event.h" #include "mgr/Registration.h" -#include "SquidTime.h" #include "Store.h" #include "tools.h" diff --git a/src/external_acl.cc b/src/external_acl.cc index 01bd3bdb70..89a3fe7dc2 100644 --- a/src/external_acl.cc +++ b/src/external_acl.cc @@ -32,7 +32,6 @@ #include "rfc1738.h" #include "SquidConfig.h" #include "SquidString.h" -#include "SquidTime.h" #include "Store.h" #include "tools.h" #include "wordlist.h" diff --git a/src/fd.cc b/src/fd.cc index 98e0df62c5..39361bea71 100644 --- a/src/fd.cc +++ b/src/fd.cc @@ -16,7 +16,6 @@ #include "fd.h" #include "fde.h" #include "globals.h" -#include "SquidTime.h" // Solaris and possibly others lack MSG_NOSIGNAL optimization // TODO: move this into compat/? Use a dedicated compat file to avoid dragging diff --git a/src/fde.cc b/src/fde.cc index 32659420b8..f73b1cb04c 100644 --- a/src/fde.cc +++ b/src/fde.cc @@ -14,7 +14,6 @@ #include "fd.h" #include "fde.h" #include "globals.h" -#include "SquidTime.h" #include "Store.h" fde *fde::Table = nullptr; diff --git a/src/format/Format.cc b/src/format/Format.cc index 4d23236e7b..f0296569dc 100644 --- a/src/format/Format.cc +++ b/src/format/Format.cc @@ -26,7 +26,6 @@ #include "sbuf/StringConvert.h" #include "security/CertError.h" #include "security/NegotiationHistory.h" -#include "SquidTime.h" #include "Store.h" #include "tools.h" #if USE_OPENSSL diff --git a/src/fqdncache.cc b/src/fqdncache.cc index 59422b755a..5eb51672b5 100644 --- a/src/fqdncache.cc +++ b/src/fqdncache.cc @@ -19,7 +19,6 @@ #include "mgr/Registration.h" #include "snmp_agent.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "StatCounters.h" #include "Store.h" #include "util.h" diff --git a/src/fs/rock/RockRebuild.cc b/src/fs/rock/RockRebuild.cc index 5d23c8c515..ff1f9e91bd 100644 --- a/src/fs/rock/RockRebuild.cc +++ b/src/fs/rock/RockRebuild.cc @@ -18,7 +18,6 @@ #include "globals.h" #include "md5.h" #include "sbuf/Stream.h" -#include "SquidTime.h" #include "Store.h" #include "tools.h" diff --git a/src/fs/ufs/RebuildState.cc b/src/fs/ufs/RebuildState.cc index 14834f29a8..eb7fc175d2 100644 --- a/src/fs/ufs/RebuildState.cc +++ b/src/fs/ufs/RebuildState.cc @@ -13,7 +13,6 @@ #include "globals.h" #include "RebuildState.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "store/Disks.h" #include "store_key_md5.h" #include "store_rebuild.h" diff --git a/src/fs/ufs/UFSSwapDir.cc b/src/fs/ufs/UFSSwapDir.cc index 3c11962149..c9899f029e 100644 --- a/src/fs/ufs/UFSSwapDir.cc +++ b/src/fs/ufs/UFSSwapDir.cc @@ -23,7 +23,6 @@ #include "RebuildState.h" #include "SquidConfig.h" #include "SquidMath.h" -#include "SquidTime.h" #include "StatCounters.h" #include "store_key_md5.h" #include "StoreSearchUFS.h" diff --git a/src/gopher.cc b/src/gopher.cc index 56c713886f..95afd9528f 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -25,7 +25,6 @@ #include "parser/Tokenizer.h" #include "rfc1738.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "StatCounters.h" #include "Store.h" #include "tools.h" @@ -333,7 +332,7 @@ gopherHTMLFooter(StoreEntry * e) storeAppendPrintf(e, "
\n"); storeAppendPrintf(e, "
\n"); storeAppendPrintf(e, "Generated %s by %s (%s)\n", - mkrfc1123(squid_curtime), + Time::FormatRfc1123(squid_curtime), getMyHostname(), visible_appname_string); storeAppendPrintf(e, "
\n"); diff --git a/src/helper.cc b/src/helper.cc index 8704aecb30..ec0cbe7975 100644 --- a/src/helper.cc +++ b/src/helper.cc @@ -27,7 +27,6 @@ #include "SquidConfig.h" #include "SquidIpc.h" #include "SquidMath.h" -#include "SquidTime.h" #include "Store.h" #include "wordlist.h" diff --git a/src/helper/Request.h b/src/helper/Request.h index 5e69f6bba4..57a5ce1307 100644 --- a/src/helper/Request.h +++ b/src/helper/Request.h @@ -10,7 +10,7 @@ #define _SQUID_SRC_HELPER_REQUEST_H #include "helper/forward.h" -#include "SquidTime.h" +#include "time/gadgets.h" namespace Helper { diff --git a/src/htcp.cc b/src/htcp.cc index 4e862316f5..c1eef39122 100644 --- a/src/htcp.cc +++ b/src/htcp.cc @@ -31,7 +31,6 @@ #include "MemBuf.h" #include "refresh.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "StatCounters.h" #include "Store.h" #include "store_key_md5.h" diff --git a/src/http.cc b/src/http.cc index b5c216a1bc..027514032d 100644 --- a/src/http.cc +++ b/src/http.cc @@ -53,7 +53,6 @@ #include "RefreshPattern.h" #include "rfc1738.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "StatCounters.h" #include "Store.h" #include "StrList.h" diff --git a/src/icmp/Icmp.cc b/src/icmp/Icmp.cc index a7af5596f8..1bee6c6106 100644 --- a/src/icmp/Icmp.cc +++ b/src/icmp/Icmp.cc @@ -11,7 +11,7 @@ #include "squid.h" #include "debug/Stream.h" #include "Icmp.h" -#include "SquidTime.h" +#include "time/gadgets.h" Icmp::Icmp() { diff --git a/src/icmp/Icmp4.cc b/src/icmp/Icmp4.cc index 15e913d1b4..7a861bca24 100644 --- a/src/icmp/Icmp4.cc +++ b/src/icmp/Icmp4.cc @@ -17,7 +17,7 @@ #include "debug/Stream.h" #include "Icmp4.h" #include "IcmpPinger.h" -#include "SquidTime.h" +#include "time/gadgets.h" static const char * IcmpPacketType(uint8_t v) diff --git a/src/icmp/Icmp6.cc b/src/icmp/Icmp6.cc index 06f8c9d4f1..a899783b1f 100644 --- a/src/icmp/Icmp6.cc +++ b/src/icmp/Icmp6.cc @@ -17,7 +17,7 @@ #include "debug/Stream.h" #include "Icmp6.h" #include "IcmpPinger.h" -#include "SquidTime.h" +#include "time/gadgets.h" // Some system headers are only neeed internally here. // They should not be included via the header. diff --git a/src/icmp/IcmpPinger.cc b/src/icmp/IcmpPinger.cc index 837a758e9b..c2b3f37cad 100644 --- a/src/icmp/IcmpPinger.cc +++ b/src/icmp/IcmpPinger.cc @@ -18,7 +18,6 @@ #include "Icmp4.h" #include "Icmp6.h" #include "IcmpPinger.h" -#include "SquidTime.h" #include diff --git a/src/icmp/IcmpSquid.cc b/src/icmp/IcmpSquid.cc index c223881391..2aef332132 100644 --- a/src/icmp/IcmpSquid.cc +++ b/src/icmp/IcmpSquid.cc @@ -19,7 +19,6 @@ #include "ip/tools.h" #include "SquidConfig.h" #include "SquidIpc.h" -#include "SquidTime.h" #include diff --git a/src/icmp/Makefile.am b/src/icmp/Makefile.am index 7c60630c8f..e6bed7d632 100644 --- a/src/icmp/Makefile.am +++ b/src/icmp/Makefile.am @@ -39,8 +39,7 @@ COPIED_SOURCE= \ globals.cc \ SquidConfig.cc \ tests/stub_HelperChildConfig.cc \ - tests/STUB.h \ - time.cc + tests/STUB.h # ICMP lookup helper pinger_SOURCES = \ @@ -60,6 +59,7 @@ pinger_LDADD=\ $(top_builddir)/src/sbuf/libsbuf.la \ $(top_builddir)/src/debug/libdebug.la \ $(top_builddir)/src/comm/libminimal.la \ + $(top_builddir)/src/time/libtime.la \ $(top_builddir)/src/base/libbase.la \ $(top_builddir)/src/mem/libminimal.la \ $(COMPAT_LIB) \ @@ -86,9 +86,6 @@ CLEANFILES += $(COPIED_SOURCE) globals.cc: $(top_srcdir)/src/globals.h cp $(top_builddir)/src/globals.cc $@ -time.cc: $(top_srcdir)/src/time.cc - cp $(top_srcdir)/src/time.cc $@ - SquidConfig.cc: $(top_srcdir)/src/SquidConfig.cc cp $(top_srcdir)/src/SquidConfig.cc $@ diff --git a/src/icmp/net_db.cc b/src/icmp/net_db.cc index a6d9769f6c..52a5fa2cba 100644 --- a/src/icmp/net_db.cc +++ b/src/icmp/net_db.cc @@ -34,7 +34,6 @@ #include "neighbors.h" #include "PeerSelectState.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" #include "StoreClient.h" #include "tools.h" diff --git a/src/icmp/pinger.cc b/src/icmp/pinger.cc index 96ce9b0661..ed45830225 100644 --- a/src/icmp/pinger.cc +++ b/src/icmp/pinger.cc @@ -41,7 +41,6 @@ #include "squid.h" #include "debug/Stream.h" -#include "SquidTime.h" #if USE_ICMP @@ -49,6 +48,7 @@ #include "Icmp6.h" #include "IcmpPinger.h" #include "ip/tools.h" +#include "time/gadgets.h" #if _SQUID_WINDOWS_ diff --git a/src/icp_v2.cc b/src/icp_v2.cc index 6d2e8f33e2..5d6d639e9b 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -35,16 +35,12 @@ #include "refresh.h" #include "rfc1738.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "StatCounters.h" #include "Store.h" #include "store_key_md5.h" #include "tools.h" #include "wordlist.h" -// for tvSubUsec() which should be in SquidTime.h -#include "util.h" - #include /// a delayed icpUdpSend() call diff --git a/src/internal.cc b/src/internal.cc index 3144b83780..4fcf48ebde 100644 --- a/src/internal.cc +++ b/src/internal.cc @@ -19,7 +19,6 @@ #include "internal.h" #include "MemBuf.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" #include "tools.h" #include "util.h" diff --git a/src/ipc_win32.cc b/src/ipc_win32.cc index 5b7cea09ac..cbd7eaf6a6 100644 --- a/src/ipc_win32.cc +++ b/src/ipc_win32.cc @@ -19,7 +19,6 @@ #include "rfc1738.h" #include "SquidConfig.h" #include "SquidIpc.h" -#include "SquidTime.h" #include "tools.h" #include diff --git a/src/ipcache.cc b/src/ipcache.cc index 275ec0448f..6b2454d64e 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -22,7 +22,6 @@ #include "mgr/Registration.h" #include "snmp_agent.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "StatCounters.h" #include "Store.h" #include "util.h" diff --git a/src/log/FormatHttpdCombined.cc b/src/log/FormatHttpdCombined.cc index 6bbc573119..92bd9b6557 100644 --- a/src/log/FormatHttpdCombined.cc +++ b/src/log/FormatHttpdCombined.cc @@ -17,7 +17,6 @@ #include "log/File.h" #include "log/Formats.h" #include "SquidConfig.h" -#include "SquidTime.h" void Log::Format::HttpdCombined(const AccessLogEntry::Pointer &al, Logfile * logfile) diff --git a/src/log/FormatHttpdCommon.cc b/src/log/FormatHttpdCommon.cc index 97e01942e7..2b58ab7056 100644 --- a/src/log/FormatHttpdCommon.cc +++ b/src/log/FormatHttpdCommon.cc @@ -17,7 +17,6 @@ #include "log/File.h" #include "log/Formats.h" #include "SquidConfig.h" -#include "SquidTime.h" void Log::Format::HttpdCommon(const AccessLogEntry::Pointer &al, Logfile * logfile) diff --git a/src/log/FormatSquidIcap.cc b/src/log/FormatSquidIcap.cc index 4d236b6fce..64cbc0bf2d 100644 --- a/src/log/FormatSquidIcap.cc +++ b/src/log/FormatSquidIcap.cc @@ -18,7 +18,6 @@ #include "log/File.h" #include "log/Formats.h" #include "SquidConfig.h" -#include "SquidTime.h" void Log::Format::SquidIcap(const AccessLogEntry::Pointer &al, Logfile * logfile) diff --git a/src/log/FormatSquidNative.cc b/src/log/FormatSquidNative.cc index 9845e02df7..67a1d4318a 100644 --- a/src/log/FormatSquidNative.cc +++ b/src/log/FormatSquidNative.cc @@ -17,7 +17,6 @@ #include "log/File.h" #include "log/Formats.h" #include "SquidConfig.h" -#include "SquidTime.h" void Log::Format::SquidNative(const AccessLogEntry::Pointer &al, Logfile * logfile) diff --git a/src/log/FormatSquidReferer.cc b/src/log/FormatSquidReferer.cc index c42ca21b47..ad1e2ffe48 100644 --- a/src/log/FormatSquidReferer.cc +++ b/src/log/FormatSquidReferer.cc @@ -13,7 +13,6 @@ #include "HttpRequest.h" #include "log/File.h" #include "log/Formats.h" -#include "SquidTime.h" void Log::Format::SquidReferer(const AccessLogEntry::Pointer &al, Logfile *logfile) diff --git a/src/log/FormatSquidUseragent.cc b/src/log/FormatSquidUseragent.cc index 55acf3ac95..dfeabc6ca7 100644 --- a/src/log/FormatSquidUseragent.cc +++ b/src/log/FormatSquidUseragent.cc @@ -13,7 +13,6 @@ #include "HttpRequest.h" #include "log/File.h" #include "log/Formats.h" -#include "SquidTime.h" void Log::Format::SquidUserAgent(const AccessLogEntry::Pointer &al, Logfile * logfile) diff --git a/src/log/ModDaemon.cc b/src/log/ModDaemon.cc index 439f23df3f..e7e99898cd 100644 --- a/src/log/ModDaemon.cc +++ b/src/log/ModDaemon.cc @@ -19,7 +19,6 @@ #include "log/ModDaemon.h" #include "SquidConfig.h" #include "SquidIpc.h" -#include "SquidTime.h" #include diff --git a/src/log/TcpLogger.cc b/src/log/TcpLogger.cc index f95f2e949b..7c23dc85e1 100644 --- a/src/log/TcpLogger.cc +++ b/src/log/TcpLogger.cc @@ -21,7 +21,6 @@ #include "Parsing.h" #include "sbuf/MemBlob.h" #include "SquidConfig.h" -#include "SquidTime.h" // a single I/O buffer should be large enough to store any access.log record const size_t Log::TcpLogger::IoBufSize = 2*MAX_URL; diff --git a/src/log/access_log.cc b/src/log/access_log.cc index db383f19e6..2faf754563 100644 --- a/src/log/access_log.cc +++ b/src/log/access_log.cc @@ -34,7 +34,6 @@ #include "rfc1738.h" #include "sbuf/SBuf.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" #if USE_SQUID_EUI diff --git a/src/main.cc b/src/main.cc index 4af501e717..a42af56307 100644 --- a/src/main.cc +++ b/src/main.cc @@ -71,13 +71,13 @@ #include "SBufStatsAction.h" #include "send-announce.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "stat.h" #include "StatCounters.h" #include "Store.h" #include "store/Disks.h" #include "store_log.h" #include "StoreFileSystem.h" +#include "time/Engine.h" #include "tools.h" #include "unlinkd.h" #include "wccp.h" @@ -1689,7 +1689,7 @@ SquidMain(int argc, char **argv) mainLoop.setPrimaryEngine(&comm_engine); /* use the standard time service */ - TimeEngine time_engine; + Time::Engine time_engine; mainLoop.setTimeService(&time_engine); diff --git a/src/mem/Meter.h b/src/mem/Meter.h index 4520620424..1aba275b28 100644 --- a/src/mem/Meter.h +++ b/src/mem/Meter.h @@ -9,7 +9,7 @@ #ifndef SQUID_SRC_MEM_METER_H #define SQUID_SRC_MEM_METER_H -#include "SquidTime.h" +#include "time/gadgets.h" namespace Mem { diff --git a/src/mem/old_api.cc b/src/mem/old_api.cc index c51625e2ab..d36a694962 100644 --- a/src/mem/old_api.cc +++ b/src/mem/old_api.cc @@ -22,7 +22,6 @@ #include "MemBuf.h" #include "mgr/Registration.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" #include diff --git a/src/mgr/Action.cc b/src/mgr/Action.cc index c875c22bfe..f4da3aaf4a 100644 --- a/src/mgr/Action.cc +++ b/src/mgr/Action.cc @@ -19,7 +19,6 @@ #include "mgr/Command.h" #include "mgr/Request.h" #include "mgr/Response.h" -#include "SquidTime.h" #include "Store.h" Mgr::Action::Action(const Command::Pointer &aCmd): cmd(aCmd) diff --git a/src/mgr/CountersAction.cc b/src/mgr/CountersAction.cc index b15dc724b7..589da5edff 100644 --- a/src/mgr/CountersAction.cc +++ b/src/mgr/CountersAction.cc @@ -13,7 +13,6 @@ #include "ipc/Messages.h" #include "ipc/TypedMsgHdr.h" #include "mgr/CountersAction.h" -#include "SquidTime.h" #include "Store.h" #include "tools.h" diff --git a/src/mgr/Forwarder.cc b/src/mgr/Forwarder.cc index 7bd86d735b..5c9f7dcc33 100644 --- a/src/mgr/Forwarder.cc +++ b/src/mgr/Forwarder.cc @@ -21,7 +21,6 @@ #include "ipc/Port.h" #include "mgr/Forwarder.h" #include "mgr/Request.h" -#include "SquidTime.h" #include "Store.h" CBDATA_NAMESPACED_CLASS_INIT(Mgr, Forwarder); diff --git a/src/mgr/InfoAction.cc b/src/mgr/InfoAction.cc index 49bbc2558f..fdc3ac2866 100644 --- a/src/mgr/InfoAction.cc +++ b/src/mgr/InfoAction.cc @@ -21,7 +21,6 @@ #include "mgr/InfoAction.h" #include "mgr/Request.h" #include "mgr/Response.h" -#include "SquidTime.h" #include "Store.h" #include "tools.h" diff --git a/src/mgr/Inquirer.cc b/src/mgr/Inquirer.cc index 9c44df087d..6a2d610fc1 100644 --- a/src/mgr/Inquirer.cc +++ b/src/mgr/Inquirer.cc @@ -25,7 +25,7 @@ #include "mgr/IntParam.h" #include "mgr/Request.h" #include "mgr/Response.h" -#include "SquidTime.h" + #include #include diff --git a/src/neighbors.cc b/src/neighbors.cc index 57af67da96..acc97465ff 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -40,7 +40,6 @@ #include "RequestFlags.h" #include "SquidConfig.h" #include "SquidMath.h" -#include "SquidTime.h" #include "stat.h" #include "Store.h" #include "store_key_md5.h" diff --git a/src/peer_digest.cc b/src/peer_digest.cc index fcc70a5cab..4bbb95fb63 100644 --- a/src/peer_digest.cc +++ b/src/peer_digest.cc @@ -22,7 +22,6 @@ #include "mime_header.h" #include "neighbors.h" #include "PeerDigest.h" -#include "SquidTime.h" #include "Store.h" #include "store_key_md5.h" #include "StoreClient.h" diff --git a/src/peer_select.cc b/src/peer_select.cc index 017b4cbcc3..9387fa3643 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -34,9 +34,8 @@ #include "peer_userhash.h" #include "PeerSelectState.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" -#include "util.h" // for tvSubDsec() which should be in SquidTime.h +#include "time/gadgets.h" /** * A CachePeer which has been selected as a possible destination. diff --git a/src/refresh.cc b/src/refresh.cc index 21c1e37b79..a8f876b76f 100644 --- a/src/refresh.cc +++ b/src/refresh.cc @@ -22,7 +22,6 @@ #include "refresh.h" #include "RefreshPattern.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" #include "util.h" @@ -294,9 +293,9 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta) debugs(22, 3, "\tage:\t" << age); - debugs(22, 3, "\tcheck_time:\t" << mkrfc1123(check_time)); + debugs(22, 3, "\tcheck_time:\t" << Time::FormatRfc1123(check_time)); - debugs(22, 3, "\tentry->timestamp:\t" << mkrfc1123(entry->timestamp)); + debugs(22, 3, "\tentry->timestamp:\t" << Time::FormatRfc1123(entry->timestamp)); if (request && !request->flags.ignoreCc) { const HttpHdrCc *const cc = request->cache_control; @@ -306,7 +305,7 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta) minFresh << " = " << age + minFresh); debugs(22, 3, "\tcheck_time + min-fresh:\t" << check_time << " + " << minFresh << " = " << - mkrfc1123(check_time + minFresh)); + Time::FormatRfc1123(check_time + minFresh)); age += minFresh; check_time += minFresh; } diff --git a/src/repl/heap/store_heap_replacement.cc b/src/repl/heap/store_heap_replacement.cc index 793166361e..885bbbe4f6 100644 --- a/src/repl/heap/store_heap_replacement.cc +++ b/src/repl/heap/store_heap_replacement.cc @@ -19,7 +19,6 @@ #include "squid.h" #include "heap.h" #include "MemObject.h" -#include "SquidTime.h" #include "Store.h" #include "store_heap_replacement.h" diff --git a/src/repl/lru/store_repl_lru.cc b/src/repl/lru/store_repl_lru.cc index 0e5767c1fe..b9ded369f9 100644 --- a/src/repl/lru/store_repl_lru.cc +++ b/src/repl/lru/store_repl_lru.cc @@ -10,7 +10,6 @@ #include "squid.h" #include "MemObject.h" -#include "SquidTime.h" #include "Store.h" /* because LruNode use explicit memory alloc()/freeOne() calls. diff --git a/src/security/cert_generators/file/Makefile.am b/src/security/cert_generators/file/Makefile.am index 565f5b3eb9..aab4174a5e 100644 --- a/src/security/cert_generators/file/Makefile.am +++ b/src/security/cert_generators/file/Makefile.am @@ -25,6 +25,7 @@ security_file_certgen_SOURCES = \ security_file_certgen_LDADD = \ $(top_builddir)/src/ssl/libsslutil.la \ + $(top_builddir)/src/time/libtime.la \ $(SSLLIB) \ $(COMPAT_LIB) diff --git a/src/security/cert_generators/file/security_file_certgen.cc b/src/security/cert_generators/file/security_file_certgen.cc index 5b96dc6708..a779150559 100644 --- a/src/security/cert_generators/file/security_file_certgen.cc +++ b/src/security/cert_generators/file/security_file_certgen.cc @@ -9,8 +9,8 @@ #include "squid.h" #include "helper/protocol_defines.h" #include "security/cert_generators/file/certificate_db.h" -#include "SquidTime.h" #include "ssl/crtd_message.h" +#include "time/gadgets.h" #include #include @@ -76,18 +76,6 @@ static const char *const B_MBYTES_STR = "MB"; static const char *const B_GBYTES_STR = "GB"; static const char *const B_BYTES_STR = "B"; -/// Get current time. -time_t getCurrentTime(void) -{ - struct timeval currentTime; -#if GETTIMEOFDAY_NO_TZP - gettimeofday(¤tTime); -#else - gettimeofday(¤tTime, nullptr); -#endif - return currentTime.tv_sec; -} - /** * Parse bytes unit. It would be one of the next value: MB, GB, KB or B. * This function is caseinsensitive. diff --git a/src/send-announce.cc b/src/send-announce.cc index 859900247c..c72ae625c6 100644 --- a/src/send-announce.cc +++ b/src/send-announce.cc @@ -20,7 +20,6 @@ #include "ipcache.h" #include "send-announce.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "tools.h" static IPH send_announce; diff --git a/src/snmp_agent.cc b/src/snmp_agent.cc index ca93bd2c20..c734124680 100644 --- a/src/snmp_agent.cc +++ b/src/snmp_agent.cc @@ -18,13 +18,11 @@ #include "snmp_core.h" #include "SquidConfig.h" #include "SquidMath.h" -#include "SquidTime.h" #include "stat.h" #include "StatCounters.h" #include "StatHist.h" #include "Store.h" #include "tools.h" -// for tvSubDsec() which should be in SquidTime.h #include "util.h" /************************************************************************ diff --git a/src/ssl/bio.cc b/src/ssl/bio.cc index f38e0cd380..2913440be1 100644 --- a/src/ssl/bio.cc +++ b/src/ssl/bio.cc @@ -21,7 +21,6 @@ #include "globals.h" #include "ip/Address.h" #include "parser/BinaryTokenizer.h" -#include "SquidTime.h" #include "ssl/bio.h" #if _SQUID_WINDOWS_ diff --git a/src/ssl/context_storage.h b/src/ssl/context_storage.h index cc59a1a0ad..acda638ae1 100644 --- a/src/ssl/context_storage.h +++ b/src/ssl/context_storage.h @@ -18,7 +18,6 @@ #include "mgr/Action.h" #include "mgr/Command.h" #include "security/forward.h" -#include "SquidTime.h" #include "ssl/gadgets.h" #include diff --git a/src/ssl/helper.cc b/src/ssl/helper.cc index 91ee78bc10..e3cce7641d 100644 --- a/src/ssl/helper.cc +++ b/src/ssl/helper.cc @@ -16,7 +16,6 @@ #include "sbuf/Stream.h" #include "SquidConfig.h" #include "SquidString.h" -#include "SquidTime.h" #include "ssl/cert_validate_message.h" #include "ssl/Config.h" #include "ssl/helper.h" diff --git a/src/ssl/support.cc b/src/ssl/support.cc index 1b402791bf..112407723d 100644 --- a/src/ssl/support.cc +++ b/src/ssl/support.cc @@ -27,7 +27,6 @@ #include "security/ErrorDetail.h" #include "security/Session.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "ssl/bio.h" #include "ssl/Config.h" #include "ssl/ErrorDetail.h" diff --git a/src/stat.cc b/src/stat.cc index 7ccabe98ee..4944bdd409 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -38,15 +38,12 @@ #include "PeerDigest.h" #include "SquidConfig.h" #include "SquidMath.h" -#include "SquidTime.h" #include "stat.h" #include "StatCounters.h" #include "Store.h" #include "store_digest.h" #include "StoreClient.h" #include "tools.h" -// for tvSubDsec() which should be in SquidTime.h -#include "util.h" #if USE_AUTH #include "auth/UserRequest.h" #endif @@ -591,10 +588,10 @@ DumpInfo(Mgr::InfoActionData& stats, StoreEntry* sentry) #endif storeAppendPrintf(sentry, "Start Time:\t%s\n", - mkrfc1123(stats.squid_start.tv_sec)); + Time::FormatRfc1123(stats.squid_start.tv_sec)); storeAppendPrintf(sentry, "Current Time:\t%s\n", - mkrfc1123(stats.current_time.tv_sec)); + Time::FormatRfc1123(stats.current_time.tv_sec)); storeAppendPrintf(sentry, "Connection information for %s:\n",APP_SHORTNAME); @@ -1024,11 +1021,11 @@ DumpAvgStat(Mgr::IntervalActionData& stats, StoreEntry* sentry) storeAppendPrintf(sentry, "sample_start_time = %d.%d (%s)\n", (int)stats.sample_start_time.tv_sec, (int)stats.sample_start_time.tv_usec, - mkrfc1123(stats.sample_start_time.tv_sec)); + Time::FormatRfc1123(stats.sample_start_time.tv_sec)); storeAppendPrintf(sentry, "sample_end_time = %d.%d (%s)\n", (int)stats.sample_end_time.tv_sec, (int)stats.sample_end_time.tv_usec, - mkrfc1123(stats.sample_end_time.tv_sec)); + Time::FormatRfc1123(stats.sample_end_time.tv_sec)); storeAppendPrintf(sentry, "client_http.requests = %f/sec\n", stats.client_http_requests); @@ -1461,7 +1458,7 @@ DumpCountersStats(Mgr::CountersActionData& stats, StoreEntry* sentry) storeAppendPrintf(sentry, "sample_time = %d.%d (%s)\n", (int) stats.sample_time.tv_sec, (int) stats.sample_time.tv_usec, - mkrfc1123(stats.sample_time.tv_sec)); + Time::FormatRfc1123(stats.sample_time.tv_sec)); storeAppendPrintf(sentry, "client_http.requests = %.0f\n", stats.client_http_requests); storeAppendPrintf(sentry, "client_http.hits = %.0f\n", diff --git a/src/store.cc b/src/store.cc index 013083ed5f..a9980f6d2f 100644 --- a/src/store.cc +++ b/src/store.cc @@ -36,7 +36,6 @@ #include "repl_modules.h" #include "RequestFlags.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "StatCounters.h" #include "stmem.h" #include "Store.h" diff --git a/src/store/Disks.cc b/src/store/Disks.cc index 49d3256b16..c61f4c1b97 100644 --- a/src/store/Disks.cc +++ b/src/store/Disks.cc @@ -23,7 +23,6 @@ #include "StoreFileSystem.h" #include "swap_log_op.h" #include "tools.h" -#include "util.h" // for tvSubDsec() which should be in SquidTime.h typedef SwapDir *STDIRSELECT(const StoreEntry *e); diff --git a/src/store_digest.cc b/src/store_digest.cc index 7be186d57d..e15197cde2 100644 --- a/src/store_digest.cc +++ b/src/store_digest.cc @@ -30,7 +30,6 @@ #include "PeerDigest.h" #include "refresh.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" #include "StoreSearch.h" #include "util.h" diff --git a/src/store_log.cc b/src/store_log.cc index 02f53ef9f4..7be648fc5f 100644 --- a/src/store_log.cc +++ b/src/store_log.cc @@ -16,7 +16,6 @@ #include "MemObject.h" #include "mgr/Registration.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" #include "store_log.h" diff --git a/src/store_rebuild.cc b/src/store_rebuild.cc index d111350666..b315064f20 100644 --- a/src/store_rebuild.cc +++ b/src/store_rebuild.cc @@ -14,7 +14,6 @@ #include "globals.h" #include "md5.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "StatCounters.h" #include "Store.h" #include "store/Disk.h" @@ -22,8 +21,7 @@ #include "store_key_md5.h" #include "store_rebuild.h" #include "StoreSearch.h" -// for tvSubDsec() which should be in SquidTime.h -#include "util.h" +#include "time/gadgets.h" #include diff --git a/src/tests/Stub.am b/src/tests/Stub.am index a7e133f906..df8894116a 100644 --- a/src/tests/Stub.am +++ b/src/tests/Stub.am @@ -64,6 +64,7 @@ STUB_SOURCE = \ tests/stub_libsecurity.cc \ tests/stub_libsslsquid.cc \ tests/stub_libstore.cc \ + tests/stub_libtime.cc \ tests/stub_main_cc.cc \ tests/stub_MemBuf.cc \ tests/stub_mem_node.cc \ @@ -85,7 +86,6 @@ STUB_SOURCE = \ tests/stub_store_rebuild.cc \ tests/stub_store_stats.cc \ tests/stub_store_swapout.cc \ - tests/stub_time.cc \ tests/stub_tools.cc \ tests/stub_tunnel.cc \ tests/stub_UdsOp.cc \ diff --git a/src/tests/stub_libtime.cc b/src/tests/stub_libtime.cc new file mode 100644 index 0000000000..0e7b883115 --- /dev/null +++ b/src/tests/stub_libtime.cc @@ -0,0 +1,37 @@ +/* + * Copyright (C) 1996-2022 The Squid Software Foundation and contributors + * + * Squid software is distributed under GPLv2+ license and includes + * contributions from numerous individuals and organizations. + * Please see the COPYING and CONTRIBUTORS files for details. + */ + +#include "squid.h" + +#define STUB_API "time/libtime.la" +#include "tests/STUB.h" + +#include "time/Engine.h" +void Time::Engine::tick() STUB + +#include "time/gadgets.h" +struct timeval current_time = {}; +double current_dtime = 0.0; +time_t squid_curtime = 0; +time_t getCurrentTime() STUB_RETVAL(0) +int tvSubUsec(struct timeval, struct timeval) STUB_RETVAL(0) +double tvSubDsec(struct timeval, struct timeval) STUB_RETVAL(0.0) +int tvSubMsec(struct timeval, struct timeval) STUB_RETVAL(0) +void tvSub(struct timeval &, struct timeval const &, struct timeval const &) STUB +void tvAdd(struct timeval &, struct timeval const &, struct timeval const &) STUB +void tvAssignAdd(struct timeval &, struct timeval const &) STUB +std::ostream &operator <<(std::ostream &os, const timeval &) STUB_RETVAL(os) +namespace Time +{ +time_t ParseIso3307(const char *) STUB_RETVAL(0) +const char *FormatRfc1123(time_t) STUB_RETVAL("") +time_t ParseRfc1123(const char *) STUB_RETVAL(0) +const char *FormatStrf(time_t) STUB_RETVAL("") +const char *FormatHttpd(time_t) STUB_RETVAL("") +} + diff --git a/src/tests/stub_store_rebuild.cc b/src/tests/stub_store_rebuild.cc index 231c2694b3..301e4f33ba 100644 --- a/src/tests/stub_store_rebuild.cc +++ b/src/tests/stub_store_rebuild.cc @@ -10,9 +10,9 @@ #include "squid.h" #include "MemBuf.h" -#include "SquidTime.h" #include "store/Controller.h" #include "store_rebuild.h" +#include "time/gadgets.h" #include diff --git a/src/tests/stub_time.cc b/src/tests/stub_time.cc deleted file mode 100644 index ae2ee9d25f..0000000000 --- a/src/tests/stub_time.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 1996-2022 The Squid Software Foundation and contributors - * - * Squid software is distributed under GPLv2+ license and includes - * contributions from numerous individuals and organizations. - * Please see the COPYING and CONTRIBUTORS files for details. - */ - -#include "squid.h" -#include "SquidTime.h" - -#define STUB_API "time.cc" -#include "tests/STUB.h" - -struct timeval current_time; -double current_dtime; -time_t squid_curtime = 0; - -time_t getCurrentTime(void) STUB_RETVAL(0) -int tvSubMsec(struct timeval, struct timeval) STUB_RETVAL(0) -void tvSub(timeval&, timeval const&, timeval const&) STUB -void tvAssignAdd(timeval&, timeval const&) STUB - -const char * Time::FormatStrf(time_t ) STUB_RETVAL("") -const char * Time::FormatHttpd(time_t ) STUB_RETVAL("") - -void TimeEngine::tick() STUB -TimeEngine::~TimeEngine() {STUB_NOP} - -std::ostream &operator <<(std::ostream &os, const timeval &) STUB_RETVAL(os) - diff --git a/src/tests/testEventLoop.cc b/src/tests/testEventLoop.cc index a18174797d..e659a27d56 100644 --- a/src/tests/testEventLoop.cc +++ b/src/tests/testEventLoop.cc @@ -9,8 +9,8 @@ #include "squid.h" #include "AsyncEngine.h" #include "EventLoop.h" -#include "SquidTime.h" #include "tests/testEventLoop.h" +#include "time/Engine.h" #include "unitTestMain.h" #include @@ -125,10 +125,8 @@ testEventLoop::testEngineErrors() /* An event loop has a time service which is like an async engine but never * generates events and there can only be one such service. */ - -class StubTime : public TimeEngine +class StubTime : public Time::Engine { - public: StubTime() : calls(0) {} diff --git a/src/tests/testStoreController.cc b/src/tests/testStoreController.cc index a4e3619be3..a1d986b1f3 100644 --- a/src/tests/testStoreController.cc +++ b/src/tests/testStoreController.cc @@ -9,7 +9,6 @@ #include "squid.h" #include "MemObject.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" #include "store/Disks.h" #include "StoreSearch.h" diff --git a/src/tests/testStoreHashIndex.cc b/src/tests/testStoreHashIndex.cc index c9e48c84d1..37c5f44185 100644 --- a/src/tests/testStoreHashIndex.cc +++ b/src/tests/testStoreHashIndex.cc @@ -9,7 +9,6 @@ #include "squid.h" #include "MemObject.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "Store.h" #include "store/Disks.h" #include "StoreSearch.h" diff --git a/src/tests/testStoreSupport.cc b/src/tests/testStoreSupport.cc index d4118726f2..789bdbc3f6 100644 --- a/src/tests/testStoreSupport.cc +++ b/src/tests/testStoreSupport.cc @@ -9,13 +9,12 @@ #include "squid.h" #include "event.h" #include "EventLoop.h" -#include "SquidTime.h" #include "testStoreSupport.h" /* construct a stock loop with event dispatching, a time service that advances * 1 second a tick */ -StockEventLoop::StockEventLoop() : default_time_engine(TimeEngine()) +StockEventLoop::StockEventLoop() : default_time_engine(Time::Engine()) { registerEngine(EventScheduler::GetInstance()); setTimeService(&default_time_engine); diff --git a/src/tests/testStoreSupport.h b/src/tests/testStoreSupport.h index 68491dcc52..435d6b069f 100644 --- a/src/tests/testStoreSupport.h +++ b/src/tests/testStoreSupport.h @@ -10,7 +10,7 @@ #define SQUID_TESTSTORESUPPORT_H #include "EventLoop.h" -#include "SquidTime.h" +#include "time/Engine.h" /* construct a stock loop with event dispatching, a time service that advances * 1 second a tick @@ -21,7 +21,7 @@ class StockEventLoop : public EventLoop public: StockEventLoop(); - TimeEngine default_time_engine; + Time::Engine default_time_engine; }; #endif /* SQUID_TESTSTORESUPPORT_H */ diff --git a/src/time/Engine.cc b/src/time/Engine.cc new file mode 100644 index 0000000000..6bffeda808 --- /dev/null +++ b/src/time/Engine.cc @@ -0,0 +1,18 @@ +/* + * Copyright (C) 1996-2022 The Squid Software Foundation and contributors + * + * Squid software is distributed under GPLv2+ license and includes + * contributions from numerous individuals and organizations. + * Please see the COPYING and CONTRIBUTORS files for details. + */ + +#include "squid.h" +#include "time/Engine.h" +#include "time/gadgets.h" + +void +Time::Engine::tick() +{ + getCurrentTime(); +} + diff --git a/src/time/Engine.h b/src/time/Engine.h new file mode 100644 index 0000000000..4855e8c14d --- /dev/null +++ b/src/time/Engine.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) 1996-2022 The Squid Software Foundation and contributors + * + * Squid software is distributed under GPLv2+ license and includes + * contributions from numerous individuals and organizations. + * Please see the COPYING and CONTRIBUTORS files for details. + */ + +#ifndef SQUID__SRC_TIME_ENGINE_H +#define SQUID__SRC_TIME_ENGINE_H + +namespace Time { + +/// event class for doing synthetic time etc +class Engine +{ +public: + virtual ~Engine() {} + + // tick the clock - update from the OS or other time source + virtual void tick(); +}; + +} // namespace Time + +#endif /* SQUID__SRC_TIME_ENGINE_H */ + diff --git a/src/time/Makefile.am b/src/time/Makefile.am new file mode 100644 index 0000000000..0177c06324 --- /dev/null +++ b/src/time/Makefile.am @@ -0,0 +1,20 @@ +## Copyright (C) 1996-2022 The Squid Software Foundation and contributors +## +## Squid software is distributed under GPLv2+ license and includes +## contributions from numerous individuals and organizations. +## Please see the COPYING and CONTRIBUTORS files for details. +## + +include $(top_srcdir)/src/Common.am +include $(top_srcdir)/src/TestHeaders.am + +noinst_LTLIBRARIES = libtime.la + +libtime_la_SOURCES = \ + Engine.cc \ + Engine.h \ + forward.h \ + gadgets.cc \ + gadgets.h \ + iso3307.cc \ + rfc1123.cc diff --git a/src/time/forward.h b/src/time/forward.h new file mode 100644 index 0000000000..490a660e2f --- /dev/null +++ b/src/time/forward.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 1996-2022 The Squid Software Foundation and contributors + * + * Squid software is distributed under GPLv2+ license and includes + * contributions from numerous individuals and organizations. + * Please see the COPYING and CONTRIBUTORS files for details. + */ + +#ifndef SQUID__SRC_TIME_FORWARD_H +#define SQUID__SRC_TIME_FORWARD_H + +/// Time and Date handling tools +namespace Time +{ + +class Engine; + +} // namespace Time + +#endif /* SQUID__SRC_TIME_FORWARD_H */ + diff --git a/src/time.cc b/src/time/gadgets.cc similarity index 90% rename from src/time.cc rename to src/time/gadgets.cc index 5fd1236588..4b75fd2c4e 100644 --- a/src/time.cc +++ b/src/time/gadgets.cc @@ -9,7 +9,7 @@ /* DEBUG: section 21 Time Functions */ #include "squid.h" -#include "SquidTime.h" +#include "time/gadgets.h" #include #include @@ -19,7 +19,7 @@ double current_dtime; time_t squid_curtime = 0; time_t -getCurrentTime(void) +getCurrentTime() { #if GETTIMEOFDAY_NO_TZP gettimeofday(¤t_time); @@ -33,6 +33,20 @@ getCurrentTime(void) return squid_curtime = current_time.tv_sec; } +int +tvSubUsec(struct timeval t1, struct timeval t2) +{ + return (t2.tv_sec - t1.tv_sec) * 1000000 + + (t2.tv_usec - t1.tv_usec); +} + +double +tvSubDsec(struct timeval t1, struct timeval t2) +{ + return (double) (t2.tv_sec - t1.tv_sec) + + (double) (t2.tv_usec - t1.tv_usec) / 1000000.0; +} + int tvSubMsec(struct timeval t1, struct timeval t2) { @@ -72,15 +86,6 @@ void tvAssignAdd(struct timeval &t, struct timeval const &add) } } -TimeEngine::~TimeEngine() -{} - -void -TimeEngine::tick() -{ - getCurrentTime(); -} - std::ostream & operator <<(std::ostream &os, const timeval &t) { diff --git a/src/SquidTime.h b/src/time/gadgets.h similarity index 59% rename from src/SquidTime.h rename to src/time/gadgets.h index a938fc9507..9f2bff8c29 100644 --- a/src/SquidTime.h +++ b/src/time/gadgets.h @@ -6,27 +6,75 @@ * Please see the COPYING and CONTRIBUTORS files for details. */ -/* DEBUG: section 21 Time Functions */ - -#ifndef SQUID_TIME_H -#define SQUID_TIME_H - -#include "rfc1123.h" +#ifndef SQUID__SRC_TIME_GADGETS_H +#define SQUID__SRC_TIME_GADGETS_H #include #include -/* NP: sys/time.h is provided by libcompat */ /* Use uint64_t to store milliseconds */ typedef uint64_t time_msec_t; -/* globals for accessing time */ -extern struct timeval current_time; +/// the current UNIX time in seconds (with microsecond precision) extern double current_dtime; + +/// the current UNIX time in seconds extern time_t squid_curtime; -time_t getCurrentTime(void); -int tvSubMsec(struct timeval, struct timeval); +/// Update squid_curtime (also current_time, and current_dtime) +/// \returns new value of squid_curtime +time_t getCurrentTime(); + +namespace Time { + +/// Convert from ISO 3307 style time: YYYYMMDDHHMMSS or YYYYMMDDHHMMSS.xxx +time_t ParseIso3307(const char *); + +/** Display time as a formatted human-readable string. + * Time string syntax used is from RFC 1123 + * "www, DD MMM YYYY hh:mm:ss GMT" + * + * Output is only valid until next call to this function. + */ +const char *FormatRfc1123(time_t); + +/// Convert from RFC 1123 style time: "www, DD MMM YYYY hh:mm:ss ZZZ" +time_t ParseRfc1123(const char *); + +/** Display time as a formatted human-readable string. + * Time syntax is + * "YYYY/MM/DD hh:mm:ss" + * + * Output is only valid until next call to this function. + */ +const char *FormatStrf(time_t); + +/** Display time as a formatted human-readable string. + * Time string syntax used is that of Apache httpd. + * "DD/MMM/YYYY:hh:mm:ss zzzz" + * + * Output is only valid until next call to this function. +*/ +const char *FormatHttpd(time_t); + +} // namespace Time + +/// the current UNIX time in timeval {seconds, microseconds} format +extern struct timeval current_time; + +/// timeval subtraction operation. +/// \returns (A-B) in whole microseconds +/// XXX: result is not compatible with time_msec_t millisecond storage +int tvSubUsec(struct timeval A, struct timeval B); + +/// timeval subtraction operation. +/// \returns (A-B) in seconds (with microsecond precision) +double tvSubDsec(struct timeval A, struct timeval B); + +/// timeval subtraction operation. +/// \returns (A-B) in whole milliseconds +/// XXX: result is not compatible with time_msec_t millisecond storage +int tvSubMsec(struct timeval A, struct timeval B); /// timeval subtraction operation /// \param[out] res = t2 - t1 @@ -41,21 +89,14 @@ void tvAdd(struct timeval &res, struct timeval const &t1, struct timeval const & void tvAssignAdd(struct timeval &t, struct timeval const &add); /// Convert timeval to milliseconds +/// XXX: result is not compatible with time_msec_t millisecond storage inline long int tvToMsec(struct timeval &t) { return t.tv_sec * 1000 + t.tv_usec / 1000; } -/** event class for doing synthetic time etc */ -class TimeEngine -{ - -public: - virtual ~TimeEngine(); - - /** tick the clock - update from the OS or other time source, */ - virtual void tick(); -}; +/// prints . +std::ostream &operator <<(std::ostream &, const timeval &); // TODO: Remove direct timercmp() calls in legacy code. @@ -98,29 +139,5 @@ operator ==(const timeval &a, const timeval &b) return !(a != b); } -/// prints . -std::ostream &operator <<(std::ostream &, const timeval &); - -namespace Time -{ - -/** Display time as a formatted human-readable string. - * Time syntax is - * "YYYY/MM/DD hh:mm:ss" - * - * Output is only valid until next call to this function. - */ -const char *FormatStrf(time_t t); - -/** Display time as a formatted human-readable string. - * Time string syntax used is that of Apache httpd. - * "DD/MMM/YYYY:hh:mm:ss zzzz" - * - * Output is only valid until next call to this function. - */ -const char *FormatHttpd(time_t t); - -} // namespace Time - -#endif /* SQUID_TIME_H */ +#endif /* SQUID__SRC_TIME_GADGETS_H */ diff --git a/lib/iso3307.c b/src/time/iso3307.cc similarity index 93% rename from lib/iso3307.c rename to src/time/iso3307.cc index 8c14e5fe13..96a35d0847 100644 --- a/lib/iso3307.c +++ b/src/time/iso3307.cc @@ -7,7 +7,7 @@ */ #include "squid.h" -#include "util.h" +#include "time/gadgets.h" #if HAVE_STRING_H #include @@ -15,14 +15,11 @@ #if HAVE_CTYPE_H #include #endif -#if HAVE_TIME_H -#include -#endif #define ASCII_DIGIT(c) ((c)-48) time_t -parse_iso3307_time(const char *buf) +Time::ParseIso3307(const char *buf) { /* buf is an ISO 3307 style time: YYYYMMDDHHMMSS or YYYYMMDDHHMMSS.xxx */ struct tm tms; diff --git a/lib/rfc1123.c b/src/time/rfc1123.cc similarity index 97% rename from lib/rfc1123.c rename to src/time/rfc1123.cc index c2cba1e746..67496768ef 100644 --- a/lib/rfc1123.c +++ b/src/time/rfc1123.cc @@ -7,7 +7,7 @@ */ #include "squid.h" -#include "rfc1123.h" +#include "time/gadgets.h" /* * Adapted from HTSUtils.c in CERN httpd 3.0 (http://info.cern.ch/httpd/) @@ -79,7 +79,7 @@ static struct tm * parse_date_elements(const char *day, const char *month, const char *year, const char *aTime, const char *zone) { static struct tm tm; - char *t; + const char *t; memset(&tm, 0, sizeof(tm)); if (!day || !month || !year || !aTime || (zone && strcmp(zone, "GMT"))) @@ -156,7 +156,7 @@ parse_date(const char *str) { } time_t -parse_rfc1123(const char *str) +Time::ParseRfc1123(const char *str) { struct tm *tm; time_t t; @@ -199,7 +199,7 @@ parse_rfc1123(const char *str) } const char * -mkrfc1123(time_t t) +Time::FormatRfc1123(time_t t) { static char buf[128]; diff --git a/src/tools.cc b/src/tools.cc index a6757b2511..0f744ab32c 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -28,7 +28,6 @@ #include "sbuf/Stream.h" #include "SquidConfig.h" #include "SquidMath.h" -#include "SquidTime.h" #include "store/Disks.h" #include "tools.h" #include "wordlist.h" diff --git a/src/tunnel.cc b/src/tunnel.cc index 20bde63ef0..7b1accdc2b 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -42,7 +42,6 @@ #include "sbuf/SBuf.h" #include "security/BlindPeerConnector.h" #include "SquidConfig.h" -#include "SquidTime.h" #include "StatCounters.h" #if USE_OPENSSL #include "ssl/bio.h" diff --git a/src/unlinkd.cc b/src/unlinkd.cc index 1e0dc0c5c4..39a0cf7427 100644 --- a/src/unlinkd.cc +++ b/src/unlinkd.cc @@ -17,7 +17,6 @@ #include "globals.h" #include "SquidConfig.h" #include "SquidIpc.h" -#include "SquidTime.h" #include "StatCounters.h" #include "store/Disk.h" #include "tools.h" diff --git a/src/urn.cc b/src/urn.cc index 9bc4e0fad2..1e0e8cd141 100644 --- a/src/urn.cc +++ b/src/urn.cc @@ -22,7 +22,6 @@ #include "MemBuf.h" #include "mime_header.h" #include "RequestFlags.h" -#include "SquidTime.h" #include "Store.h" #include "StoreClient.h" #include "tools.h" diff --git a/test-suite/Makefile.am b/test-suite/Makefile.am index d54a8bb50d..f478f904c2 100644 --- a/test-suite/Makefile.am +++ b/test-suite/Makefile.am @@ -13,7 +13,7 @@ AM_CPPFLAGS += -I$(srcdir) LDADD = \ $(top_builddir)/src/base/libbase.la \ $(top_builddir)/src/globals.o \ - $(top_builddir)/src/time.o \ + $(top_builddir)/src/time/libtime.la \ $(top_builddir)/lib/libmiscutil.la \ $(COMPAT_LIB) \ $(XTRA_LIBS) diff --git a/tools/Makefile.am b/tools/Makefile.am index 80a09f7d8c..d0950c4160 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -18,6 +18,7 @@ DISTCLEANFILES= LDADD= \ $(top_builddir)/src/ip/libip.la \ $(top_builddir)/src/mem/libminimal.la \ + $(top_builddir)/src/time/libtime.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ $(COMPAT_LIB) \ @@ -44,9 +45,6 @@ CharacterSet.cc: $(top_srcdir)/src/base/CharacterSet.cc MemBuf.cc: $(top_srcdir)/src/MemBuf.cc cp $(top_srcdir)/src/MemBuf.cc $@ -time.cc: $(top_srcdir)/src/time.cc - cp $(top_srcdir)/src/time.cc $@ - tests/stub_cbdata.cc: $(top_srcdir)/src/tests/stub_cbdata.cc | tests cp $(top_srcdir)/src/tests/stub_cbdata.cc $@ @@ -61,7 +59,7 @@ tests: # globals.cc is needed by test_tools.cc. # Neither of these should be disted from here. TESTSOURCES= test_tools.cc -CLEANFILES += test_tools.cc Here.cc CharacterSet.cc MemBuf.cc tests/stub_debug.cc time.cc tests/stub_cbdata.cc tests/STUB.h +CLEANFILES += test_tools.cc Here.cc CharacterSet.cc MemBuf.cc tests/stub_debug.cc tests/stub_cbdata.cc tests/STUB.h ## Test Scripts EXTRA_DIST += helper-ok-dying.pl helper-ok.pl @@ -77,8 +75,7 @@ cachemgr__CGIEXT__SOURCES = \ Here.cc \ MemBuf.cc \ cachemgr.cc \ - test_tools.cc \ - time.cc + test_tools.cc nodist_cachemgr__CGIEXT__SOURCES = \ tests/stub_cbdata.cc \ diff --git a/tools/cachemgr.cc b/tools/cachemgr.cc index b59dfa6447..68e861d6f0 100644 --- a/tools/cachemgr.cc +++ b/tools/cachemgr.cc @@ -13,8 +13,8 @@ #include "html_quote.h" #include "ip/Address.h" #include "MemBuf.h" -#include "rfc1123.h" #include "rfc1738.h" +#include "time/gadgets.h" #include "util.h" #include @@ -237,7 +237,7 @@ print_trailer(void) printf("
\n"); printf("
\n"); printf("Generated %s, by %s/%s@%s\n", - mkrfc1123(now), progname, VERSION, getfullhostname()); + Time::FormatRfc1123(now), progname, VERSION, getfullhostname()); printf("
\n"); } diff --git a/tools/squidclient/Makefile.am b/tools/squidclient/Makefile.am index 2ff2477c4f..2c745b0276 100644 --- a/tools/squidclient/Makefile.am +++ b/tools/squidclient/Makefile.am @@ -15,6 +15,7 @@ DISTCLEANFILES = LDADD = \ $(top_builddir)/src/ip/libip.la \ $(top_builddir)/src/mem/libminimal.la \ + $(top_builddir)/src/time/libtime.la \ $(top_builddir)/src/base/libbase.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ @@ -34,9 +35,6 @@ test_tools.cc: $(top_srcdir)/test-suite/test_tools.cc tests/stub_debug.cc: $(top_srcdir)/src/tests/stub_debug.cc | tests cp $(top_srcdir)/src/tests/stub_debug.cc $@ -time.cc: $(top_srcdir)/src/time.cc - cp $(top_srcdir)/src/time.cc $@ - tests/STUB.h: $(top_srcdir)/src/tests/STUB.h | tests cp $(top_srcdir)/src/tests/STUB.h $@ @@ -48,7 +46,7 @@ tests: # globals.cc is needed by test_tools.cc. # Neither of these should be disted from here. TESTSOURCES= test_tools.cc -CLEANFILES += test_tools.cc tests/stub_debug.cc time.cc tests/STUB.h +CLEANFILES += test_tools.cc tests/stub_debug.cc tests/STUB.h ## ##### squidclient ##### @@ -63,8 +61,7 @@ squidclient_SOURCES = \ gssapi_support.cc \ gssapi_support.h \ squidclient.cc \ - test_tools.cc \ - time.cc + test_tools.cc nodist_squidclient_SOURCES = \ tests/stub_debug.cc \ diff --git a/tools/squidclient/Ping.cc b/tools/squidclient/Ping.cc index 23037ffeed..ec136f6f30 100644 --- a/tools/squidclient/Ping.cc +++ b/tools/squidclient/Ping.cc @@ -7,7 +7,7 @@ */ #include "squid.h" -#include "SquidTime.h" +#include "time/gadgets.h" #include "tools/squidclient/Parameters.h" #include "tools/squidclient/Ping.h" diff --git a/tools/squidclient/squidclient.cc b/tools/squidclient/squidclient.cc index 1eb6568f4c..9c1d17067e 100644 --- a/tools/squidclient/squidclient.cc +++ b/tools/squidclient/squidclient.cc @@ -10,7 +10,7 @@ #include "base64.h" #include "ip/Address.h" #include "ip/tools.h" -#include "rfc1123.h" +#include "time/gadgets.h" #include "tools/squidclient/gssapi_support.h" #include "tools/squidclient/Parameters.h" #include "tools/squidclient/Ping.h" @@ -505,7 +505,7 @@ main(int argc, char *argv[]) msg << "Accept: */*\r\n"; } if (ims) { - msg << "If-Modified-Since: " << mkrfc1123(ims) << "\r\n"; + msg << "If-Modified-Since: " << Time::FormatRfc1123(ims) << "\r\n"; } if (max_forwards > -1) { msg << "Max-Forwards: " << max_forwards << "\r\n";