]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SourceLayout: Move time related tools to time/libtime.la (#1001)
authorAmos Jeffries <yadij@users.noreply.github.com>
Wed, 13 Apr 2022 23:32:16 +0000 (23:32 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Thu, 14 Apr 2022 05:02:57 +0000 (05:02 +0000)
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.

155 files changed:
configure.ac
include/rfc1123.h [deleted file]
include/util.h
lib/Makefile.am
lib/util.c
src/DiskIO/DiskDaemon/DiskdIOStrategy.cc
src/DiskIO/DiskDaemon/Makefile.am
src/DiskIO/DiskFile.h
src/DiskIO/DiskThreads/aiops.cc
src/DiskIO/DiskThreads/aiops_win32.cc
src/DiskIO/IpcIo/IpcIoFile.cc
src/EventLoop.cc
src/EventLoop.h
src/ExternalACLEntry.cc
src/FadingCounter.cc
src/FwdState.cc
src/HttpHeader.cc
src/HttpReply.cc
src/Makefile.am
src/MessageDelayPools.cc
src/PeerPoolMgr.cc
src/SquidConfig.h
src/acl/Time.cc
src/acl/external/kerberos_ldap_group/support_krb5.cc
src/adaptation/History.cc
src/adaptation/ecap/XactionRep.cc
src/adaptation/icap/History.cc
src/adaptation/icap/ModXact.cc
src/adaptation/icap/OptXact.cc
src/adaptation/icap/Options.cc
src/adaptation/icap/ServiceRep.cc
src/adaptation/icap/Xaction.cc
src/auth/User.cc
src/auth/basic/Config.cc
src/auth/basic/UserRequest.cc
src/auth/digest/Config.cc
src/auth/digest/UserRequest.cc
src/auth/negotiate/Config.cc
src/auth/negotiate/UserRequest.cc
src/auth/ntlm/Config.cc
src/auth/ntlm/UserRequest.cc
src/base/ClpMap.h
src/cache_manager.cc
src/client_db.cc
src/client_side.cc
src/client_side_reply.cc
src/client_side_request.cc
src/clients/Client.cc
src/clients/FtpGateway.cc
src/clients/FtpRelay.cc
src/comm/ConnOpener.cc
src/comm/Connection.cc
src/comm/Connection.h
src/comm/ModDevPoll.cc
src/comm/ModEpoll.cc
src/comm/ModKqueue.cc
src/comm/ModPoll.cc
src/comm/ModSelect.cc
src/comm/ModSelectWin32.cc
src/comm/TcpAcceptor.cc
src/comm/Write.cc
src/debug/debug.cc
src/delay_pools.cc
src/dns_internal.cc
src/errorpage.cc
src/event.cc
src/external_acl.cc
src/fd.cc
src/fde.cc
src/format/Format.cc
src/fqdncache.cc
src/fs/rock/RockRebuild.cc
src/fs/ufs/RebuildState.cc
src/fs/ufs/UFSSwapDir.cc
src/gopher.cc
src/helper.cc
src/helper/Request.h
src/htcp.cc
src/http.cc
src/icmp/Icmp.cc
src/icmp/Icmp4.cc
src/icmp/Icmp6.cc
src/icmp/IcmpPinger.cc
src/icmp/IcmpSquid.cc
src/icmp/Makefile.am
src/icmp/net_db.cc
src/icmp/pinger.cc
src/icp_v2.cc
src/internal.cc
src/ipc_win32.cc
src/ipcache.cc
src/log/FormatHttpdCombined.cc
src/log/FormatHttpdCommon.cc
src/log/FormatSquidIcap.cc
src/log/FormatSquidNative.cc
src/log/FormatSquidReferer.cc
src/log/FormatSquidUseragent.cc
src/log/ModDaemon.cc
src/log/TcpLogger.cc
src/log/access_log.cc
src/main.cc
src/mem/Meter.h
src/mem/old_api.cc
src/mgr/Action.cc
src/mgr/CountersAction.cc
src/mgr/Forwarder.cc
src/mgr/InfoAction.cc
src/mgr/Inquirer.cc
src/neighbors.cc
src/peer_digest.cc
src/peer_select.cc
src/refresh.cc
src/repl/heap/store_heap_replacement.cc
src/repl/lru/store_repl_lru.cc
src/security/cert_generators/file/Makefile.am
src/security/cert_generators/file/security_file_certgen.cc
src/send-announce.cc
src/snmp_agent.cc
src/ssl/bio.cc
src/ssl/context_storage.h
src/ssl/helper.cc
src/ssl/support.cc
src/stat.cc
src/store.cc
src/store/Disks.cc
src/store_digest.cc
src/store_log.cc
src/store_rebuild.cc
src/tests/Stub.am
src/tests/stub_libtime.cc [new file with mode: 0644]
src/tests/stub_store_rebuild.cc
src/tests/stub_time.cc [deleted file]
src/tests/testEventLoop.cc
src/tests/testStoreController.cc
src/tests/testStoreHashIndex.cc
src/tests/testStoreSupport.cc
src/tests/testStoreSupport.h
src/time/Engine.cc [new file with mode: 0644]
src/time/Engine.h [new file with mode: 0644]
src/time/Makefile.am [new file with mode: 0644]
src/time/forward.h [new file with mode: 0644]
src/time/gadgets.cc [moved from src/time.cc with 90% similarity]
src/time/gadgets.h [moved from src/SquidTime.h with 59% similarity]
src/time/iso3307.cc [moved from lib/iso3307.c with 93% similarity]
src/time/rfc1123.cc [moved from lib/rfc1123.c with 97% similarity]
src/tools.cc
src/tunnel.cc
src/unlinkd.cc
src/urn.cc
test-suite/Makefile.am
tools/Makefile.am
tools/cachemgr.cc
tools/squidclient/Makefile.am
tools/squidclient/Ping.cc
tools/squidclient/squidclient.cc

index 2eed09b0080e1e6379da724ad00212425dcabe94..d097afe0e7b52a713b20429a728fa593c2b7527b 100644 (file)
@@ -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 (file)
index 19e4c29..0000000
+++ /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 */
-
index af72febcc7bbca6a65634e148b2540b3843c9b86..d64745fa514b89424edd60fc7da27becc3849d8a 100644 (file)
@@ -9,19 +9,12 @@
 #ifndef SQUID_UTIL_H
 #define SQUID_UTIL_H
 
-#if HAVE_TIME_H
-#include <time.h>
-#endif
 #if HAVE_ARPA_INET_H
 #include <arpa/inet.h>
 #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);
index b5bc65ef0a9200d6b6f43a605c7a154c73be2440..d1fb753083adeeb8a1de2d4224751622299768dd 100644 (file)
@@ -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
index 9213e892b82ff5dbc20a9f4a0d42ab845b0e2654..7d8be0bcfe75ee591665b1ccc36878988a45e304 100644 (file)
@@ -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)
index bdfe6d5ab438cbca9d03c8df4bc9fc543a03ca14..8da369263ce1c1cb45d14cf5bf6ff8b16d9e5a0c 100644 (file)
@@ -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"
index 283208de67f9f45b270f8d860897c95c80353ef0..bf0531444d9751434095fed69ffa702cb4110ef0 100644 (file)
@@ -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
index 4976f797e42c24987713bb22d286aec6252f3d30..65a821728d0200f3989a0a43d5348e08c81f8519 100644 (file)
@@ -10,7 +10,7 @@
 #define SQUID_DISKFILE_H
 
 #include "base/RefCount.h"
-#include "SquidTime.h"
+#include "time/gadgets.h"
 
 class IORequestor;
 
index 58c4dd7d74cd7915c5476abd9c876f15c07da329..d979cb260b6f3763da7ab21757db71d9da53a777 100644 (file)
@@ -16,7 +16,6 @@
 #include "DiskIO/DiskThreads/CommIO.h"
 #include "DiskThreads.h"
 #include "SquidConfig.h"
-#include "SquidTime.h"
 #include "Store.h"
 
 /*
index 9e30898e6e6618616bbea0f13588c28b4a80d154..a03bec906bfe3a52db33b0eaa3ab6414d94f8e17 100644 (file)
@@ -14,7 +14,6 @@
 #include "fd.h"
 #include "mem/Pool.h"
 #include "SquidConfig.h"
-#include "SquidTime.h"
 #include "Store.h"
 
 #include <cerrno>
index e9f54a3a25fe2490eb6503446ad8c251122ca39e..c769a283eceddbb87064e955da35918e6e6dcb28 100644 (file)
@@ -29,7 +29,6 @@
 #include "ipc/UdsOp.h"
 #include "sbuf/SBuf.h"
 #include "SquidConfig.h"
-#include "SquidTime.h"
 #include "StatCounters.h"
 #include "tools.h"
 
index 967726d1295c8c8f0f24fae95d8b618aa004c16e..4ee03c1aa24017abe144e8ed2828a155fbceff96 100644 (file)
@@ -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;
 }
index ad9081adfe2e2ae7c14d087aa0a583547a5e1716..5150db432431cb3b71aa4af7dc877dbbf31d7458 100644 (file)
@@ -9,12 +9,13 @@
 #ifndef SQUID_EVENTLOOP_H
 #define SQUID_EVENTLOOP_H
 
+#include "time/forward.h"
+
 #include <vector>
 
 #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<AsyncEngine *> 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 */
index 9417edea4ad8afb92c8e88225c57d672537702c1..d12550ea50bc5168c094a65ea3f6a3981f30c73d 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "squid.h"
 #include "ExternalACLEntry.h"
-#include "SquidTime.h"
+#include "time/gadgets.h"
 
 /******************************************************************
  * external_acl cache
index 687ef82c015b22beed3906e65e9ce59a3f6cf4a7..54f9fa5a3e13cbfbc5685f0eb8de1a9cb3f8b708 100644 (file)
@@ -10,7 +10,7 @@
 #include "base/TextException.h"
 #include "debug/Stream.h"
 #include "FadingCounter.h"
-#include "SquidTime.h"
+#include "time/gadgets.h"
 
 #include <cmath>
 
index 6448595493bb96b8ebb52661b37cdc7145ec1a67..826c0e34b6cb2d0dc6704ea55d69ce4bb9061787 100644 (file)
@@ -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"
index 318af12069d408fab0dd12f9d1414c729e68d78d..1a69b6b2ab1115d3d5859a31016a75518432a332 100644 (file)
 #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 <algorithm>
@@ -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;
         }
index 2c34f9f7ed30648ceaa60d080011741b4d3b8e12..d3fa3217fd421a374e411ccad8f30f49f7206971 100644 (file)
@@ -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
             }
         }
index 589d5ac9cf9e151e608d2607f2a9402f8b71aadc..56af821837a19274edfde2e0e3bf21a4feaeb60f 100644 (file)
@@ -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) \
index 8258c6e77d667a25d0c1d60ca9b39efe446b3044..8d06f5db9f85f34432a3c77d03433814db97d033 100644 (file)
@@ -17,7 +17,6 @@
 #include "MessageBucket.h"
 #include "MessageDelayPools.h"
 #include "Parsing.h"
-#include "SquidTime.h"
 #include "Store.h"
 
 #include <algorithm>
index 252a259dd2cac047a4a897bca77ebf7336cbcaed..60d7343f40701936099a83d9f355544614f6b2c7 100644 (file)
@@ -24,7 +24,6 @@
 #include "PeerPoolMgr.h"
 #include "security/BlindPeerConnector.h"
 #include "SquidConfig.h"
-#include "SquidTime.h"
 
 CBDATA_CLASS_INIT(PeerPoolMgr);
 
index f13ff835fba0708db7d973c15cfc6fc1e9f2d285..c70d9ed3e667e74448576695c3f02d5c6e9f370c 100644 (file)
 #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 <chrono>
 
index 828aeb76a47236130f6c202b39cbf490f0aae9f8..2351c7ed3e1619ad24746a79f54f8381b206a09e 100644 (file)
@@ -11,7 +11,6 @@
 #include "squid.h"
 #include "acl/Time.h"
 #include "acl/TimeData.h"
-#include "SquidTime.h"
 
 int
 ACLTimeStrategy::match(ACLData<MatchType> * &data, ACLFilledChecklist *)
index a0e76cc0c1ed2a47d2228ca214fb849654404ac9..dc51552c294ad1b5431d5cf350980adfc28922ef 100644 (file)
@@ -31,7 +31,8 @@
  */
 
 #include "squid.h"
-#include "util.h"
+
+#include <ctime>
 
 #if HAVE_LDAP && HAVE_KRB5
 
index e5f4be2b4401edafd26cfb2bf105a0aac15b5bb9..6dc8bd685d3710f8c74eab1fc0485436e3af4b0d 100644 (file)
@@ -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,";
index 8a5edc89c401a7628e203e1d6463c6139d279747..b45b671bc538f0533d26515ae3fff6cd46363e03 100644 (file)
@@ -24,7 +24,6 @@
 #include "HttpReply.h"
 #include "HttpRequest.h"
 #include "MasterXaction.h"
-#include "SquidTime.h"
 
 CBDATA_NAMESPACED_CLASS_INIT(Adaptation::Ecap::XactionRep, XactionRep);
 
index f70275fd0b97ee26a7743932db7dad1275cadb3c..de6191409e6239fc0985e3f980b43dedc6d2d402 100644 (file)
@@ -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),
index e62d2c3c49e0500a9fca8a7a8adaa6997eb0423c..ede6822c40ca821ea4745be9b6a3200d60d33aa7 100644 (file)
@@ -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");
index 0e36bfce5897999e59501ea90c9cdef78a82ff0d..42531b97e662029b5beca424592267751b9f8057 100644 (file)
@@ -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);
index 0bbbc6c227b54d306ab0650f2254237302896316..1544ebf76abee4e4c1be72b0b87defd6f8bb10e2 100644 (file)
@@ -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"
 
index 8ef224dc11d08450714ec217ad67d71f02b5ef1f..ed12f4b7ded15770cf4c7b0120255c73c20233c3 100644 (file)
@@ -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
index a91d0c56ea45e858e7136eeff2c8d3740d4be39c..499c618dd0b5f6bd37297dcd6221feb6efd3e5a9 100644 (file)
@@ -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<Adaptation::Icap::Xaction, Security::EncryptorAnswer, Security::EncryptorAnswer&>,
index a1a429bf1478ee58cd0cd5fdd90d95fb0a6a4eb3..0ba33d3ed80608a0cb68c37ac18d4392a8a492a2 100644 (file)
@@ -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) :
index 485d99d72a4496c2c7670be1ea32045e84ab9c3d..8f46cc4fdcecce453af03318790ab7a48385db70 100644 (file)
@@ -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"
index a384a3faf64c718e5f6a126e66ffd06f4bf811d6..b1b037d06fce322a4cf0bf8c92c16fd7d34fd631 100644 (file)
@@ -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
index c785bc3cb9892d88c84db370fa0fb301385ba754..158876cfafdae8b754c22ed32e10570ed7e8fccd 100644 (file)
@@ -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"
index 81cae2ffb1ca8ec740399ef350e8733e3b597ec3..14951f34e26d2b6b6f51fb6425436fc906cf1258 100644 (file)
@@ -19,7 +19,6 @@
 #include "HttpReply.h"
 #include "HttpRequest.h"
 #include "MemBuf.h"
-#include "SquidTime.h"
 
 Auth::Digest::UserRequest::UserRequest() :
     noncehex(NULL),
index b1756730e16920f2ac91898d03352d615c8f6418..e8c5915d8b29480f5d0cd83619c88128e3cfb816 100644 (file)
@@ -27,7 +27,6 @@
 #include "HttpReply.h"
 #include "HttpRequest.h"
 #include "mgr/Registration.h"
-#include "SquidTime.h"
 #include "Store.h"
 #include "wordlist.h"
 
index e02fe56d475017c9f374087d0393412c3826843b..f56c4d74a184dcec4332ab029cea78a04eeaeb48 100644 (file)
@@ -25,7 +25,6 @@
 #include "HttpReply.h"
 #include "HttpRequest.h"
 #include "MemBuf.h"
-#include "SquidTime.h"
 
 Auth::Negotiate::UserRequest::UserRequest() :
     server_blob(nullptr),
index 4ad5f68418311e39a570d48b17bc9c50771fa5b7..d30d51858835b058ece86eed34683c0026488b82 100644 (file)
@@ -27,7 +27,6 @@
 #include "HttpReply.h"
 #include "HttpRequest.h"
 #include "mgr/Registration.h"
-#include "SquidTime.h"
 #include "Store.h"
 #include "wordlist.h"
 
index a41a48af257c8fe6c8a66330dfad3224f04e40da..4445f0174ab43152e62a57ea39cc8d9034c4af09 100644 (file)
@@ -23,7 +23,6 @@
 #include "http/Stream.h"
 #include "HttpRequest.h"
 #include "MemBuf.h"
-#include "SquidTime.h"
 
 Auth::Ntlm::UserRequest::UserRequest() :
     server_blob(nullptr),
index cb3d2229eeb7ea233822be158cb8d7633e4ed8fe..f8c6200b8c514600d3b38969dee7a08a436a1912 100644 (file)
@@ -12,7 +12,7 @@
 #include "base/Optional.h"
 #include "mem/PoolingAllocator.h"
 #include "SquidMath.h"
-#include "SquidTime.h"
+#include "time/gadgets.h"
 
 #include <functional>
 #include <limits>
index 4a2f30b191d20faedee7da59b2f79d5a2cdb7000..4c053aa3f437544991600e5c704c0e702dfdb4f7 100644 (file)
@@ -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"
index a8bf0a7b2226525bbd5987a4824f5cf01250d0a8..8016fbab3e092bf237c38ba87a117818f01990d9 100644 (file)
@@ -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"
index f6c04d16a23e98efc6e2a4e60aba4ec2027e9806..16dc4b449d25d2120e8e980f685937c506e0a2fc 100644 (file)
 #include "security/NegotiationHistory.h"
 #include "servers/forward.h"
 #include "SquidConfig.h"
-#include "SquidTime.h"
 #include "StatCounters.h"
 #include "StatHist.h"
 #include "Store.h"
 #include "ssl/support.h"
 #endif
 
-// for tvSubUsec() which should be in SquidTime.h
-#include "util.h"
-
 #include <climits>
 #include <cmath>
 #include <limits>
index f35c1cc117da41b35decf22b03960307127ed3fd..ca6334ac8e147cc8d767b4681273e4df8eb19fbc 100644 (file)
@@ -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"
index bbdd45ac64ca541cf7e53cf9b4cfbc0d4b754db6..e7e6cd0131f5e15f76dde9f5b193033796c2c030 100644 (file)
@@ -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"
index 30ad799d6aafb3ee267178635fed7162ec1c5236..530dbbabc493714a564aaa0ca92104a9ed4b5ba2 100644 (file)
@@ -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"
index ae18fe2c291fca5a1d98f4979ef37d5161804be9..395ec6765e25c7bac0db6cff0f79168ebe768229 100644 (file)
@@ -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);
index 768fbce7105b210d3086dcd49526ee09343d3e7a..9b0d7fbd6a473bccbf03bab72467c6a08f661e8b 100644 (file)
@@ -22,7 +22,6 @@
 #include "HttpRequest.h"
 #include "sbuf/SBuf.h"
 #include "servers/FtpServer.h"
-#include "SquidTime.h"
 #include "Store.h"
 #include "wordlist.h"
 
index da709976faa5466ae67c0aa9b3cdf224b824ac12..e705cb16aa87f547041a5050c2417e75861df385 100644 (file)
@@ -22,7 +22,6 @@
 #include "ip/tools.h"
 #include "ipcache.h"
 #include "SquidConfig.h"
-#include "SquidTime.h"
 
 #include <cerrno>
 
index 517831ecf8b93806c654ae8e0b9c43ed47052a3e..2e2f1d70523e355aed13b2e63dd81c413c3cd1ad 100644 (file)
@@ -17,7 +17,7 @@
 #include "neighbors.h"
 #include "security/NegotiationHistory.h"
 #include "SquidConfig.h"
-#include "SquidTime.h"
+
 #include <ostream>
 
 InstanceIdDefinitions(Comm::Connection, "conn", uint64_t);
index 2d3ce32ea1ebb802a6871cde171730bfd3140af9..d4672b69032425cfa139ba6721efe8c88cd3d369 100644 (file)
@@ -23,7 +23,7 @@
 #include "ip/Address.h"
 #include "ip/forward.h"
 #include "mem/forward.h"
-#include "SquidTime.h"
+#include "time/gadgets.h"
 
 #include <iosfwd>
 #include <ostream>
index 3031acb1ef5f6208b61def11ecf4e3f9f9210e8d..dbad789a6a9dae718816673cc3ad6a992e54d076 100644 (file)
@@ -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"
index 46bb7b3c83bdd76da48a139cd9639ec6a9f84552..4b13050455bcf70852c28ad1abaf676e4ec177b4 100644 (file)
@@ -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"
index 38dd4da009f2a6eb589b34869cf3ef79c1f71b6d..694eb3e3dc0f37d28c0f9f9de32b27aeab29bc56 100644 (file)
@@ -35,7 +35,6 @@
 #include "comm/Loops.h"
 #include "fde.h"
 #include "globals.h"
-#include "SquidTime.h"
 #include "StatCounters.h"
 #include "Store.h"
 
index 113f9e59f9826357d93c248b7582790799689600..2b659890b7eb9d1d99d35f06395db759f52838b6 100644 (file)
@@ -20,7 +20,6 @@
 #include "ICP.h"
 #include "mgr/Registration.h"
 #include "SquidConfig.h"
-#include "SquidTime.h"
 #include "StatCounters.h"
 #include "Store.h"
 
index 7c4d80b71b0627501c5f68fd9717d8c3f6085451..b5fc8ef0de078ce88a6667318ae113cc4803893b 100644 (file)
@@ -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"
index 8a501d55afe8fdd974c72e284c7ccd05db6a5be8..6becb3d11b86f008b926eabd6ba3744cb95ca623 100644 (file)
@@ -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"
index b27f0ac96b28ee2450219073c5b8287c726925b3..b93991ef8bbe498dd0062eac0a06ef9429c72f59 100644 (file)
@@ -28,7 +28,6 @@
 #include "log/access_log.h"
 #include "MasterXaction.h"
 #include "SquidConfig.h"
-#include "SquidTime.h"
 #include "StatCounters.h"
 
 #include <cerrno>
index aeee04db9888ab5c84f7cb7e29a649373b12f379..436847ca77676435f669f55321edc724d853599c 100644 (file)
@@ -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"
index 10508ca669c4c2a68dccd4ea87e148b35dc71c50..bc466a3196ae87852eabdfb7d63ecbb1ae58d416 100644 (file)
@@ -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 <algorithm>
index d27fefc1b8263e336136e3eac610e7f02b86f946..457847a4695e13b0ef9e701eddbcf0b20fa6e322 100644 (file)
@@ -36,7 +36,6 @@
 #include "mgr/Registration.h"
 #include "NullDelayId.h"
 #include "SquidString.h"
-#include "SquidTime.h"
 #include "Store.h"
 #include "StoreClient.h"
 
index a36579397bca4331b596fda8bd5bd4c69dc89a95..a4dbf2be5110f94df593f9e71df6a13846a1e68c 100644 (file)
@@ -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"
index 3b9de53ed8406926931801fb08d867ba189479f6..662ec859738d8b74179ac7fcb979e3c702dbcbd3 100644 (file)
@@ -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':
index a344b12f499c2eb6903dc5f570a6d20629d501e5..dcaed3188e0486d20a75794c75104b2bfa21d982 100644 (file)
@@ -11,7 +11,6 @@
 #include "squid.h"
 #include "event.h"
 #include "mgr/Registration.h"
-#include "SquidTime.h"
 #include "Store.h"
 #include "tools.h"
 
index 01bd3bdb70d58f1f6c9fc86decf93aca634813dc..89a3fe7dc2a9396316a53f799cb46337ddbc92b9 100644 (file)
@@ -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"
index 98e0df62c5444ed847ac19bf3c70a68955590c58..39361bea71b0e70dc4cf42a5d9375726b8de1628 100644 (file)
--- 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
index 32659420b8d4e709d7fc05e6977096eccc7c9731..f73b1cb04c6cfb1b92eb72e71327929976630d9b 100644 (file)
@@ -14,7 +14,6 @@
 #include "fd.h"
 #include "fde.h"
 #include "globals.h"
-#include "SquidTime.h"
 #include "Store.h"
 
 fde *fde::Table = nullptr;
index 4d23236e7bd01e1cbe410427545049bf8151c209..f0296569dc8b7829f781d08851546ffe6d11ed52 100644 (file)
@@ -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
index 59422b755a7634f6f45488a297d854265849dccf..5eb51672b5c30a29ab71b1fea9db3df6f08c3e5c 100644 (file)
@@ -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"
index 5d23c8c515d706496df538efa90feb3dd88e3969..ff1f9e91bd54dec9f1fd4430f531240b14fa4f2f 100644 (file)
@@ -18,7 +18,6 @@
 #include "globals.h"
 #include "md5.h"
 #include "sbuf/Stream.h"
-#include "SquidTime.h"
 #include "Store.h"
 #include "tools.h"
 
index 14834f29a8236409e337eb414d21d7143d4eabe8..eb7fc175d2c07b7cd4e5a21bb178560c8da31328 100644 (file)
@@ -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"
index 3c11962149e5632346683f166a0359d93e91f24b..c9899f029e37419c03169a21044b472dd5a9c6ba 100644 (file)
@@ -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"
index 56c713886ff97d31fa2f16ec3ffeff1fa4c883f4..95afd9528f1ab8cc630ff80befe6bd6e551e72e0 100644 (file)
@@ -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, "<HR noshade size=\"1px\">\n");
     storeAppendPrintf(e, "<ADDRESS>\n");
     storeAppendPrintf(e, "Generated %s by %s (%s)\n",
-                      mkrfc1123(squid_curtime),
+                      Time::FormatRfc1123(squid_curtime),
                       getMyHostname(),
                       visible_appname_string);
     storeAppendPrintf(e, "</ADDRESS></BODY></HTML>\n");
index 8704aecb306be69edf412e93f6d650ddcd34c02c..ec0cbe79758a9328b9c9a7b285cb85dd52c101c1 100644 (file)
@@ -27,7 +27,6 @@
 #include "SquidConfig.h"
 #include "SquidIpc.h"
 #include "SquidMath.h"
-#include "SquidTime.h"
 #include "Store.h"
 #include "wordlist.h"
 
index 5e69f6bba484deeb491a6b9fe1bb51b23328fb0b..57a5ce1307f4be86b8bf7e043547e242038398ac 100644 (file)
@@ -10,7 +10,7 @@
 #define _SQUID_SRC_HELPER_REQUEST_H
 
 #include "helper/forward.h"
-#include "SquidTime.h"
+#include "time/gadgets.h"
 
 namespace Helper
 {
index 4e862316f52d79579ba5d38c4feea161b023dce9..c1eef39122eeaed1d1a355eb6e44d04f0798909d 100644 (file)
@@ -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"
index b5c216a1bce80c78988c979d4c1d693d3dc6890e..027514032d33775cba7a8064bc63449deb14cc39 100644 (file)
@@ -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"
index a7af5596f8af0c90cffd7f00458b1948275cf370..1bee6c6106b275e599da5673b4cf06410a923f42 100644 (file)
@@ -11,7 +11,7 @@
 #include "squid.h"
 #include "debug/Stream.h"
 #include "Icmp.h"
-#include "SquidTime.h"
+#include "time/gadgets.h"
 
 Icmp::Icmp()
 {
index 15e913d1b43583de18f6ef7bddb393d91a592630..7a861bca24f53d628742e8bab987a13aedd60321 100644 (file)
@@ -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)
index 06f8c9d4f1f4df350656c04eda0eaf2312554c3f..a899783b1f1743d73a2f9ba528d2a2bd357c16c5 100644 (file)
@@ -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.
index 837a758e9b31344d9e1d1477cd01380f4e09075f..c2b3f37cad522836e1b16e8f2a65ea43ea7aa58a 100644 (file)
@@ -18,7 +18,6 @@
 #include "Icmp4.h"
 #include "Icmp6.h"
 #include "IcmpPinger.h"
-#include "SquidTime.h"
 
 #include <cerrno>
 
index c2238813910d53e2adcced70ba0c89c70557469e..2aef33213220eaa526d62e44a930d481fcb992a8 100644 (file)
@@ -19,7 +19,6 @@
 #include "ip/tools.h"
 #include "SquidConfig.h"
 #include "SquidIpc.h"
-#include "SquidTime.h"
 
 #include <cerrno>
 
index 7c60630c8f558211ba1cc5b1aae0eb8fef0fb0e3..e6bed7d6322794fa89fa8ef63a12861ef63bed79 100644 (file)
@@ -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 $@
 
index a6d9769f6c97d57a2a12f9f44bbbb374ba38c6ce..52a5fa2cba57aab4baeca222e36a922a9792cfb2 100644 (file)
@@ -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"
index 96ce9b0661734d81db5bd6fc26b3e9f61ba4d9b2..ed458302257c6c1987ab2abfc889c10f603b679a 100644 (file)
@@ -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_
 
index 6d2e8f33e2a2639ba2e7df5b67cc32385c3db9af..5d6d639e9b590cc4f2863fa18dfea2aa1638dfc7 100644 (file)
 #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 <cerrno>
 
 /// a delayed icpUdpSend() call
index 3144b8378037cc545edce467fa6f77ad50f628ee..4fcf48ebdeeb0c943a4f0adb3fade4fe3590bd3e 100644 (file)
@@ -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"
index 5b7cea09ac4aefeb2fb5085fb38a37fc8479caf6..cbd7eaf6a63073ba3b93a7452a3a2aa51f7fe16a 100644 (file)
@@ -19,7 +19,6 @@
 #include "rfc1738.h"
 #include "SquidConfig.h"
 #include "SquidIpc.h"
-#include "SquidTime.h"
 #include "tools.h"
 
 #include <cerrno>
index 275ec0448fdc6e19eb2da770123aa7c3315f67ff..6b2454d64e4b79bfe39209ca691ca3a59627704c 100644 (file)
@@ -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"
index 6bbc573119c7d6f5e97ba0acd6f239b73cd0a6bd..92bd9b65578ad0c12d962a1002a39a90fe9c0e6a 100644 (file)
@@ -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)
index 97e01942e785120adb5107c75bfc0f70639e8088..2b58ab70561c3342672ef7eaa793703de3ea1aee 100644 (file)
@@ -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)
index 4d236b6fcea2b775b2dbf8d5d7c80107fbc48a41..64cbc0bf2d254b2a2f09f979d5317ff49b644a0b 100644 (file)
@@ -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)
index 9845e02df7bccb16914672c52b5e016d75bc7692..67a1d4318aba26d04c0691311f3e5d58f76f81b0 100644 (file)
@@ -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)
index c42ca21b478b756e8f7beaac3d465ecd9398ff5e..ad1e2ffe48355f43dccdc079489f844555c010db 100644 (file)
@@ -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)
index 55acf3ac95aa8495c226cc16525524b61ba5b385..dfeabc6ca7b831230f3bec65c9731f2c65a5842a 100644 (file)
@@ -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)
index 439f23df3f1d3d5234f339630b7a97bc2f8851d6..e7e99898cd27330aaf893779c5859d93ec13a180 100644 (file)
@@ -19,7 +19,6 @@
 #include "log/ModDaemon.h"
 #include "SquidConfig.h"
 #include "SquidIpc.h"
-#include "SquidTime.h"
 
 #include <cerrno>
 
index f95f2e949bc8c003ba5b73c4c6091e060a1adbc5..7c23dc85e1fb2b88736db0fa8dfe0749c363ecb4 100644 (file)
@@ -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;
index db383f19e6abb572d7062296eb2b802b96ce7a63..2faf754563be95b78f57b31a2ba1dba11d75afea 100644 (file)
@@ -34,7 +34,6 @@
 #include "rfc1738.h"
 #include "sbuf/SBuf.h"
 #include "SquidConfig.h"
-#include "SquidTime.h"
 #include "Store.h"
 
 #if USE_SQUID_EUI
index 4af501e7175d53cc43c6338916ca7675886a9319..a42af56307c1bee0c986165cd1ab33487ea9a617 100644 (file)
 #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);
 
index 4520620424b0b9e455bc8e497175b96e9e59ce72..1aba275b288f14db9e4c8d23baf930415db4bc7f 100644 (file)
@@ -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
 {
index c51625e2ab1ff8fa3984646d0b781a7a781a3797..d36a694962d06e500aa29b0ba740518312440e0e 100644 (file)
@@ -22,7 +22,6 @@
 #include "MemBuf.h"
 #include "mgr/Registration.h"
 #include "SquidConfig.h"
-#include "SquidTime.h"
 #include "Store.h"
 
 #include <iomanip>
index c875c22bfed3a8cb35c25791c30030439a185341..f4da3aaf4a5c340cffe77be077eb01f601f5936c 100644 (file)
@@ -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)
index b15dc724b71bf6d22ff8e49bb8251c8f5a0a7ae3..589da5edff9968bc1d19bf5b662350a4b269c8ae 100644 (file)
@@ -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"
 
index 7bd86d735bf48cc748635ef1148bc12c238a6d25..5c9f7dcc33a2ac8ecc3f634ef48a3cd8db530818 100644 (file)
@@ -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);
index 49bbc2558fd12cb3177833ef0ba118f6e26a2644..fdc3ac2866dec3fb41cdb4317cb53b5a7a17d91d 100644 (file)
@@ -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"
 
index 9c44df087db0c16454a24921e5854b050e1b72ce..6a2d610fc1d9d11fea8f38c5dd906404d4e2c2a7 100644 (file)
@@ -25,7 +25,7 @@
 #include "mgr/IntParam.h"
 #include "mgr/Request.h"
 #include "mgr/Response.h"
-#include "SquidTime.h"
+
 #include <memory>
 #include <algorithm>
 
index 57af67da96d3bb77be281af41b2fb7e7905fe62d..acc97465ff25689fe30e26ea12cc6c3b9cca33fe 100644 (file)
@@ -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"
index fcc70a5cab01167ab8232654a67cec5f5c311b0f..4bbb95fb632047cc4bb3012b3d9eea2705ead079 100644 (file)
@@ -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"
index 017b4cbcc31497152bc6b36c7bf6e4b918154f03..9387fa3643cb289e1d74eeb6fe87f4519d785fbd 100644 (file)
@@ -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.
index 21c1e37b79e0646e03f1e98e09d04b310c149a02..a8f876b76f91bfd7dda64d642987544053704fe5 100644 (file)
@@ -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;
         }
index 793166361e374afad72aa708ae8d81042b4f6b8a..885bbbe4f623dda60272b39caa4596229bd8d9de 100644 (file)
@@ -19,7 +19,6 @@
 #include "squid.h"
 #include "heap.h"
 #include "MemObject.h"
-#include "SquidTime.h"
 #include "Store.h"
 #include "store_heap_replacement.h"
 
index 0e5767c1feb80c58304fcfcb2eb46f6e2f6d92bc..b9ded369f9c3db4c736f18e3ef7ee40b0fcb48d4 100644 (file)
@@ -10,7 +10,6 @@
 
 #include "squid.h"
 #include "MemObject.h"
-#include "SquidTime.h"
 #include "Store.h"
 
 /* because LruNode use explicit memory alloc()/freeOne() calls.
index 565f5b3eb9ca22013dc0fdf9115e5f8b0f8fc521..aab4174a5edfaffd16197b75a04c208306b1a078 100644 (file)
@@ -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)
 
index 5b96dc6708482e23a892dc64aa13cc62e890ba61..a7791505592e72af744eee294875aa12bd885cd5 100644 (file)
@@ -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 <cstring>
 #include <iostream>
@@ -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(&currentTime);
-#else
-    gettimeofday(&currentTime, 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.
index 859900247cc11b1068fac70f49557f282f1ede4f..c72ae625c67569951dd7bb1f831baceb619b699d 100644 (file)
@@ -20,7 +20,6 @@
 #include "ipcache.h"
 #include "send-announce.h"
 #include "SquidConfig.h"
-#include "SquidTime.h"
 #include "tools.h"
 
 static IPH send_announce;
index ca93bd2c204f51a51d8d0c2e2e97ce770524771d..c7341246800f09f99d626e355428140563159c54 100644 (file)
 #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"
 
 /************************************************************************
index f38e0cd380dc500dea66d7a2987f9e3b044afb84..2913440be1a7e3594782d9f4c536d192d4c06c82 100644 (file)
@@ -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_
index cc59a1a0ad86341ba779aaf2b6e67f4bb5eb326b..acda638ae1c7a6b982916f25463d99822dba9a6c 100644 (file)
@@ -18,7 +18,6 @@
 #include "mgr/Action.h"
 #include "mgr/Command.h"
 #include "security/forward.h"
-#include "SquidTime.h"
 #include "ssl/gadgets.h"
 
 #include <list>
index 91ee78bc105026dde91a47293e43456ad5a82492..e3cce7641da9ae9633917e545aeb667c7e0db2a0 100644 (file)
@@ -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"
index 1b402791bf7809ea102e457093edb237b10fcf47..112407723dbcbe02e1aadeb97e8c8e979e49985f 100644 (file)
@@ -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"
index 7ccabe98ee18ca1a221c6e56e1ece62496688aa2..4944bdd409eb18c49611a83782e5fed320116419 100644 (file)
 #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",
index 013083ed5f3502f5e473234c4635741c1432b245..a9980f6d2f4f924f452841a738035705ad81d987 100644 (file)
@@ -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"
index 49d3256b16665e723509b5997bbfe6d2823b2b45..c61f4c1b97852ff84f67958840403d7af4371e8f 100644 (file)
@@ -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);
 
index 7be186d57d36aeb7768810226255992b51f6c7de..e15197cde2c8d6652a33ef23aac61c01c074845c 100644 (file)
@@ -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"
index 02f53ef9f47de7c5d2132527e4b97a4e6c37899c..7be648fc5f353f4099a4093ac666c6c660df3031 100644 (file)
@@ -16,7 +16,6 @@
 #include "MemObject.h"
 #include "mgr/Registration.h"
 #include "SquidConfig.h"
-#include "SquidTime.h"
 #include "Store.h"
 #include "store_log.h"
 
index d111350666968d440517f19e8d82ca8b37f11772..b315064f202e5db45cf3097b67c63dba94a4d850 100644 (file)
@@ -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 <cerrno>
 
index a7e133f90699bf7905dc80f096f95413fcb7e153..df8894116ab4f3293c2098c2ba39fd160547a6c2 100644 (file)
@@ -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 (file)
index 0000000..0e7b883
--- /dev/null
@@ -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("")
+}
+
index 231c2694b3708a30e11bbf24e03eaa0855d56c70..301e4f33ba34aa4fbd3199351b327d1a264abffd 100644 (file)
@@ -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 <cstring>
 
diff --git a/src/tests/stub_time.cc b/src/tests/stub_time.cc
deleted file mode 100644 (file)
index ae2ee9d..0000000
+++ /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)
-
index a18174797d657843325e4c1afe3cf93fe9b61d5f..e659a27d5652093e0f2af3704b62ac7dd9f19346 100644 (file)
@@ -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 <cppunit/TestAssert.h>
@@ -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) {}
 
index a4e3619be36545c351b2673d607fa4660416e927..a1d986b1f3ef5eebc25caa3398c33a4464045e24 100644 (file)
@@ -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"
index c9e48c84d1e107ecf4f683e85451e9c3b80103d8..37c5f44185bc3ccdfa8f4d27cffee09f473c2b79 100644 (file)
@@ -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"
index d4118726f20675812029350785c933d544f86004..789bdbc3f6ba1d30e0fca1b608f6103d591d5f33 100644 (file)
@@ -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);
index 68491dcc525fb26cbd1ef945ed6ceffad9acb363..435d6b069fba2cc9daf17c175587328a448ec84f 100644 (file)
@@ -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 (file)
index 0000000..6bffeda
--- /dev/null
@@ -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 (file)
index 0000000..4855e8c
--- /dev/null
@@ -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 (file)
index 0000000..0177c06
--- /dev/null
@@ -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 (file)
index 0000000..490a660
--- /dev/null
@@ -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 */
+
similarity index 90%
rename from src/time.cc
rename to src/time/gadgets.cc
index 5fd1236588600c26abd35a1f543e84bd6a534fca..4b75fd2c4ef7d2359517b9b1cb853c5ea8e95007 100644 (file)
@@ -9,7 +9,7 @@
 /* DEBUG: section 21    Time Functions */
 
 #include "squid.h"
-#include "SquidTime.h"
+#include "time/gadgets.h"
 
 #include <iomanip>
 #include <ostream>
@@ -19,7 +19,7 @@ double current_dtime;
 time_t squid_curtime = 0;
 
 time_t
-getCurrentTime(void)
+getCurrentTime()
 {
 #if GETTIMEOFDAY_NO_TZP
     gettimeofday(&current_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)
 {
similarity index 59%
rename from src/SquidTime.h
rename to src/time/gadgets.h
index a938fc95070bcab7dcf35c7f079b65719ef634d3..9f2bff8c29841605a6a475df8fecf8cf2b903ea1 100644 (file)
@@ -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 <ctime>
 #include <iosfwd>
-/* 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 <seconds>.<microseconds>
+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 <seconds>.<microseconds>
-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 */
 
similarity index 93%
rename from lib/iso3307.c
rename to src/time/iso3307.cc
index 8c14e5fe13089eacd093dfdd9e16e8359cd99610..96a35d084774578ba56e5add9c226c33414cb32e 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #include "squid.h"
-#include "util.h"
+#include "time/gadgets.h"
 
 #if HAVE_STRING_H
 #include <string.h>
 #if HAVE_CTYPE_H
 #include <ctype.h>
 #endif
-#if HAVE_TIME_H
-#include <time.h>
-#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;
similarity index 97%
rename from lib/rfc1123.c
rename to src/time/rfc1123.cc
index c2cba1e746de2398515d6fa7edceefddb1252fcf..67496768ef2d836565a0cd77f714f14269585033 100644 (file)
@@ -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];
 
index a6757b2511cc20ab2337728899deb6a14c5d1799..0f744ab32c618e519870916bcf0192b55c2e25ba 100644 (file)
@@ -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"
index 20bde63ef07c73d94782f7cf637caf14d0f2cf58..7b1accdc2b2390f3f76fd664d8b3a4f1da510a1f 100644 (file)
@@ -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"
index 1e0dc0c5c4b0b5a7767cf073a2776797fca568cf..39a0cf742799565e3f151df375893dc03c688355 100644 (file)
@@ -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"
index 9bc4e0fad267de4c23a550688ee6ab154e18fd00..1e0e8cd141f582f2bbf92df63208607d59500d5a 100644 (file)
@@ -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"
index d54a8bb50d19accbe1862d9fa62c7e31c46244c5..f478f904c25830056a2fdc88eafb286fcdf64270 100644 (file)
@@ -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)
index 80a09f7d8c695692de4dd69e3b00016e98de2330..d0950c4160952be7a2f43e49c96968b411bd2e02 100644 (file)
@@ -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 \
index b59dfa6447e28680f3adcabdadee3843aef39154..68e861d6f0968e020c2505b127bee9901213e84c 100644 (file)
@@ -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 <cctype>
@@ -237,7 +237,7 @@ print_trailer(void)
     printf("<HR noshade size=\"1px\">\n");
     printf("<ADDRESS>\n");
     printf("Generated %s, by %s/%s@%s\n",
-           mkrfc1123(now), progname, VERSION, getfullhostname());
+           Time::FormatRfc1123(now), progname, VERSION, getfullhostname());
     printf("</ADDRESS></BODY></HTML>\n");
 }
 
index 2ff2477c4f8a8ada0618a392886baf7bcb7d4503..2c745b0276da17adbff8f9621d7e4135ccbaa809 100644 (file)
@@ -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 \
index 23037ffeed2481e01c82f140d6d22e8a4b27d414..ec136f6f30ef87e36d1da21ce556c75069d0113d 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #include "squid.h"
-#include "SquidTime.h"
+#include "time/gadgets.h"
 #include "tools/squidclient/Parameters.h"
 #include "tools/squidclient/Ping.h"
 
index 1eb6568f4c41a1cc719ceff9692d061dabade552..9c1d17067e08384c8a7eeaa91f0a839334667995 100644 (file)
@@ -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";