From e9af692973a5db95ac1b07f430fd801c0c07dac9 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Wed, 8 May 2019 15:47:58 +0200
Subject: [PATCH] util/Time*: move to time/

---
 meson.build                                    |  1 +
 src/PlaylistDatabase.cxx                       |  2 +-
 src/SongPrint.cxx                              |  2 +-
 src/SongSave.cxx                               |  2 +-
 src/Stats.cxx                                  |  2 +-
 src/TimePrint.cxx                              |  2 +-
 src/command/OtherCommands.cxx                  |  2 +-
 src/command/PlaylistCommands.cxx               |  2 +-
 src/command/StorageCommands.cxx                |  2 +-
 src/db/DatabasePrint.cxx                       |  2 +-
 src/db/plugins/simple/DirectorySave.cxx        |  2 +-
 src/song/Filter.cxx                            |  4 ++--
 src/song/ModifiedSinceSongFilter.cxx           |  2 +-
 src/song/meson.build                           |  1 +
 src/storage/plugins/CurlStorage.cxx            |  5 +++--
 src/storage/plugins/meson.build                |  1 +
 src/tag/Format.cxx                             |  2 +-
 src/tag/meson.build                            |  1 +
 src/{util => time}/ChronoUtil.hxx              |  0
 src/{util/TimeConvert.cxx => time/Convert.cxx} |  2 +-
 src/{util/TimeConvert.hxx => time/Convert.hxx} |  0
 src/{util/TimeISO8601.cxx => time/ISO8601.cxx} |  6 +++---
 src/{util/TimeISO8601.hxx => time/ISO8601.hxx} |  4 ++--
 src/{util/TimeParser.cxx => time/Parser.cxx}   |  4 ++--
 src/{util/TimeParser.hxx => time/Parser.hxx}   |  0
 src/time/meson.build                           | 11 +++++++++++
 src/util/meson.build                           |  3 ---
 test/run_storage.cxx                           |  2 +-
 test/test_translate_song.cxx                   |  2 +-
 29 files changed, 42 insertions(+), 29 deletions(-)
 rename src/{util => time}/ChronoUtil.hxx (100%)
 rename src/{util/TimeConvert.cxx => time/Convert.cxx} (98%)
 rename src/{util/TimeConvert.hxx => time/Convert.hxx} (100%)
 rename src/{util/TimeISO8601.cxx => time/ISO8601.cxx} (95%)
 rename src/{util/TimeISO8601.hxx => time/ISO8601.hxx} (96%)
 rename src/{util/TimeParser.cxx => time/Parser.cxx} (98%)
 rename src/{util/TimeParser.hxx => time/Parser.hxx} (100%)
 create mode 100644 src/time/meson.build

diff --git a/meson.build b/meson.build
index e18e7d6bf..93952164d 100644
--- a/meson.build
+++ b/meson.build
@@ -304,6 +304,7 @@ if enable_database
 endif
 
 subdir('src/util')
+subdir('src/time')
 subdir('src/system')
 subdir('src/thread')
 subdir('src/event')
diff --git a/src/PlaylistDatabase.cxx b/src/PlaylistDatabase.cxx
index 0adc58949..c29bc1c1b 100644
--- a/src/PlaylistDatabase.cxx
+++ b/src/PlaylistDatabase.cxx
@@ -21,8 +21,8 @@
 #include "db/PlaylistVector.hxx"
 #include "fs/io/TextFile.hxx"
 #include "fs/io/BufferedOutputStream.hxx"
+#include "time/ChronoUtil.hxx"
 #include "util/StringStrip.hxx"
-#include "util/ChronoUtil.hxx"
 #include "util/RuntimeError.hxx"
 
 #include <string.h>
diff --git a/src/SongPrint.cxx b/src/SongPrint.cxx
index e2e7680f4..6299cc556 100644
--- a/src/SongPrint.cxx
+++ b/src/SongPrint.cxx
@@ -27,7 +27,7 @@
 #include "TagPrint.hxx"
 #include "client/Response.hxx"
 #include "fs/Traits.hxx"
-#include "util/ChronoUtil.hxx"
+#include "time/ChronoUtil.hxx"
 #include "util/UriUtil.hxx"
 
 #define SONG_FILE "file: "
diff --git a/src/SongSave.cxx b/src/SongSave.cxx
index 954203f0c..45a2c3723 100644
--- a/src/SongSave.cxx
+++ b/src/SongSave.cxx
@@ -27,7 +27,7 @@
 #include "tag/ParseName.hxx"
 #include "tag/Tag.hxx"
 #include "tag/Builder.hxx"
-#include "util/ChronoUtil.hxx"
+#include "time/ChronoUtil.hxx"
 #include "util/StringAPI.hxx"
 #include "util/StringBuffer.hxx"
 #include "util/StringStrip.hxx"
diff --git a/src/Stats.cxx b/src/Stats.cxx
index b8773d6f0..2bf4458fc 100644
--- a/src/Stats.cxx
+++ b/src/Stats.cxx
@@ -28,7 +28,7 @@
 #include "db/Stats.hxx"
 #include "system/Clock.hxx"
 #include "Log.hxx"
-#include "util/ChronoUtil.hxx"
+#include "time/ChronoUtil.hxx"
 
 #include <chrono>
 #include <cmath>
diff --git a/src/TimePrint.cxx b/src/TimePrint.cxx
index eaac793d9..8ccf8b236 100644
--- a/src/TimePrint.cxx
+++ b/src/TimePrint.cxx
@@ -19,7 +19,7 @@
 
 #include "TimePrint.hxx"
 #include "client/Response.hxx"
-#include "util/TimeISO8601.hxx"
+#include "time/ISO8601.hxx"
 
 void
 time_print(Response &r, const char *name,
diff --git a/src/command/OtherCommands.cxx b/src/command/OtherCommands.cxx
index f441c73e0..fe9978b1e 100644
--- a/src/command/OtherCommands.cxx
+++ b/src/command/OtherCommands.cxx
@@ -35,7 +35,7 @@
 #include "decoder/DecoderPrint.hxx"
 #include "ls.hxx"
 #include "mixer/Volume.hxx"
-#include "util/ChronoUtil.hxx"
+#include "time/ChronoUtil.hxx"
 #include "util/UriUtil.hxx"
 #include "util/StringAPI.hxx"
 #include "fs/AllocatedPath.hxx"
diff --git a/src/command/PlaylistCommands.cxx b/src/command/PlaylistCommands.cxx
index 2914ea82b..b5265e6f0 100644
--- a/src/command/PlaylistCommands.cxx
+++ b/src/command/PlaylistCommands.cxx
@@ -37,9 +37,9 @@
 #include "client/Response.hxx"
 #include "Mapper.hxx"
 #include "fs/AllocatedPath.hxx"
+#include "time/ChronoUtil.hxx"
 #include "util/UriUtil.hxx"
 #include "util/ConstBuffer.hxx"
-#include "util/ChronoUtil.hxx"
 #include "LocateUri.hxx"
 
 bool
diff --git a/src/command/StorageCommands.cxx b/src/command/StorageCommands.cxx
index 2333eca4a..7926b66c3 100644
--- a/src/command/StorageCommands.cxx
+++ b/src/command/StorageCommands.cxx
@@ -23,8 +23,8 @@
 #include "StorageCommands.hxx"
 #include "Request.hxx"
 #include "CommandError.hxx"
+#include "time/ChronoUtil.hxx"
 #include "util/UriUtil.hxx"
-#include "util/ChronoUtil.hxx"
 #include "util/ConstBuffer.hxx"
 #include "fs/Traits.hxx"
 #include "client/Client.hxx"
diff --git a/src/db/DatabasePrint.cxx b/src/db/DatabasePrint.cxx
index deb430b1a..1a8567b88 100644
--- a/src/db/DatabasePrint.cxx
+++ b/src/db/DatabasePrint.cxx
@@ -34,7 +34,7 @@
 #include "PlaylistInfo.hxx"
 #include "Interface.hxx"
 #include "fs/Traits.hxx"
-#include "util/ChronoUtil.hxx"
+#include "time/ChronoUtil.hxx"
 #include "util/RecursiveMap.hxx"
 
 #include <functional>
diff --git a/src/db/plugins/simple/DirectorySave.cxx b/src/db/plugins/simple/DirectorySave.cxx
index 085139fe3..40b71f9eb 100644
--- a/src/db/plugins/simple/DirectorySave.cxx
+++ b/src/db/plugins/simple/DirectorySave.cxx
@@ -25,7 +25,7 @@
 #include "PlaylistDatabase.hxx"
 #include "fs/io/TextFile.hxx"
 #include "fs/io/BufferedOutputStream.hxx"
-#include "util/ChronoUtil.hxx"
+#include "time/ChronoUtil.hxx"
 #include "util/StringCompare.hxx"
 #include "util/NumberParser.hxx"
 #include "util/RuntimeError.hxx"
diff --git a/src/song/Filter.cxx b/src/song/Filter.cxx
index 0725083a6..9e1c4590a 100644
--- a/src/song/Filter.cxx
+++ b/src/song/Filter.cxx
@@ -29,8 +29,9 @@
 #include "AudioParser.hxx"
 #include "tag/ParseName.hxx"
 #include "tag/Tag.hxx"
+#include "time/ChronoUtil.hxx"
+#include "time/ISO8601.hxx"
 #include "util/CharUtil.hxx"
-#include "util/ChronoUtil.hxx"
 #include "util/ConstBuffer.hxx"
 #include "util/RuntimeError.hxx"
 #include "util/StringAPI.hxx"
@@ -38,7 +39,6 @@
 #include "util/StringStrip.hxx"
 #include "util/StringView.hxx"
 #include "util/ASCII.hxx"
-#include "util/TimeISO8601.hxx"
 #include "util/UriUtil.hxx"
 #include "lib/icu/CaseFold.hxx"
 
diff --git a/src/song/ModifiedSinceSongFilter.cxx b/src/song/ModifiedSinceSongFilter.cxx
index ed14a31ad..e490bce8a 100644
--- a/src/song/ModifiedSinceSongFilter.cxx
+++ b/src/song/ModifiedSinceSongFilter.cxx
@@ -19,7 +19,7 @@
 
 #include "ModifiedSinceSongFilter.hxx"
 #include "LightSong.hxx"
-#include "util/TimeISO8601.hxx"
+#include "time/ISO8601.hxx"
 
 std::string
 ModifiedSinceSongFilter::ToExpression() const noexcept
diff --git a/src/song/meson.build b/src/song/meson.build
index 36abdc073..d8b443656 100644
--- a/src/song/meson.build
+++ b/src/song/meson.build
@@ -24,6 +24,7 @@ song_dep = declare_dependency(
     icu_dep,
     pcre_dep,
     tag_dep,
+    time_dep,
     util_dep,
   ],
 )
diff --git a/src/storage/plugins/CurlStorage.cxx b/src/storage/plugins/CurlStorage.cxx
index ee1c00845..b4e73ba0a 100644
--- a/src/storage/plugins/CurlStorage.cxx
+++ b/src/storage/plugins/CurlStorage.cxx
@@ -35,12 +35,13 @@
 #include "event/DeferEvent.hxx"
 #include "thread/Mutex.hxx"
 #include "thread/Cond.hxx"
+#include "time/ChronoUtil.hxx"
+#include "time/Parser.hxx"
 #include "util/ASCII.hxx"
-#include "util/ChronoUtil.hxx"
+#include "time/ChronoUtil.hxx"
 #include "util/RuntimeError.hxx"
 #include "util/StringCompare.hxx"
 #include "util/StringFormat.hxx"
-#include "util/TimeParser.hxx"
 #include "util/UriUtil.hxx"
 
 #include <algorithm>
diff --git a/src/storage/plugins/meson.build b/src/storage/plugins/meson.build
index e13a2f316..0d2705fcb 100644
--- a/src/storage/plugins/meson.build
+++ b/src/storage/plugins/meson.build
@@ -57,5 +57,6 @@ storage_plugins_dep = declare_dependency(
   dependencies: [
     storage_api_dep,
     fs_dep,
+    time_dep,
   ],
 )
diff --git a/src/tag/Format.cxx b/src/tag/Format.cxx
index a86e4643e..01fdba995 100644
--- a/src/tag/Format.cxx
+++ b/src/tag/Format.cxx
@@ -20,9 +20,9 @@
 #include "Format.hxx"
 #include "Tag.hxx"
 #include "ParseName.hxx"
+#include "time/Convert.hxx"
 #include "util/format.h"
 #include "util/TruncateString.hxx"
-#include "util/TimeConvert.hxx"
 
 #include <algorithm>
 
diff --git a/src/tag/meson.build b/src/tag/meson.build
index 08b9e5e92..13ca102d5 100644
--- a/src/tag/meson.build
+++ b/src/tag/meson.build
@@ -48,6 +48,7 @@ tag = static_library(
 tag_dep = declare_dependency(
   link_with: tag,
   dependencies: [
+    time_dep,
     util_dep,
   ],
 )
diff --git a/src/util/ChronoUtil.hxx b/src/time/ChronoUtil.hxx
similarity index 100%
rename from src/util/ChronoUtil.hxx
rename to src/time/ChronoUtil.hxx
diff --git a/src/util/TimeConvert.cxx b/src/time/Convert.cxx
similarity index 98%
rename from src/util/TimeConvert.cxx
rename to src/time/Convert.cxx
index e0d506018..5f2b8bdb5 100644
--- a/src/util/TimeConvert.cxx
+++ b/src/time/Convert.cxx
@@ -30,7 +30,7 @@
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "TimeConvert.hxx"
+#include "Convert.hxx"
 
 #include <stdexcept>
 
diff --git a/src/util/TimeConvert.hxx b/src/time/Convert.hxx
similarity index 100%
rename from src/util/TimeConvert.hxx
rename to src/time/Convert.hxx
diff --git a/src/util/TimeISO8601.cxx b/src/time/ISO8601.cxx
similarity index 95%
rename from src/util/TimeISO8601.cxx
rename to src/time/ISO8601.cxx
index 0a9480c85..b9ce08361 100644
--- a/src/util/TimeISO8601.cxx
+++ b/src/time/ISO8601.cxx
@@ -30,9 +30,9 @@
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "TimeISO8601.hxx"
-#include "TimeConvert.hxx"
-#include "TimeParser.hxx"
+#include "ISO8601.hxx"
+#include "Convert.hxx"
+#include "Parser.hxx"
 
 StringBuffer<64>
 FormatISO8601(const struct tm &tm) noexcept
diff --git a/src/util/TimeISO8601.hxx b/src/time/ISO8601.hxx
similarity index 96%
rename from src/util/TimeISO8601.hxx
rename to src/time/ISO8601.hxx
index 81e5593d3..10a171d26 100644
--- a/src/util/TimeISO8601.hxx
+++ b/src/time/ISO8601.hxx
@@ -33,8 +33,8 @@
 #ifndef TIME_ISO8601_HXX
 #define TIME_ISO8601_HXX
 
-#include "StringBuffer.hxx"
-#include "Compiler.h"
+#include "util/StringBuffer.hxx"
+#include "util/Compiler.h"
 
 #include <string>
 #include <chrono>
diff --git a/src/util/TimeParser.cxx b/src/time/Parser.cxx
similarity index 98%
rename from src/util/TimeParser.cxx
rename to src/time/Parser.cxx
index 5576b5a7d..b09bba14f 100644
--- a/src/util/TimeParser.cxx
+++ b/src/time/Parser.cxx
@@ -27,8 +27,8 @@
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "TimeParser.hxx"
-#include "Compiler.h"
+#include "Parser.hxx"
+#include "util/Compiler.h"
 
 #include <stdexcept>
 
diff --git a/src/util/TimeParser.hxx b/src/time/Parser.hxx
similarity index 100%
rename from src/util/TimeParser.hxx
rename to src/time/Parser.hxx
diff --git a/src/time/meson.build b/src/time/meson.build
new file mode 100644
index 000000000..2c53f7848
--- /dev/null
+++ b/src/time/meson.build
@@ -0,0 +1,11 @@
+time = static_library(
+  'time',
+  'Parser.cxx',
+  'Convert.cxx',
+  'ISO8601.cxx',
+  include_directories: inc,
+)
+
+time_dep = declare_dependency(
+  link_with: time,
+)
diff --git a/src/util/meson.build b/src/util/meson.build
index 2384b96a3..98c28eb36 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -16,9 +16,6 @@ util = static_library(
   'SplitString.cxx',
   'FormatString.cxx',
   'Tokenizer.cxx',
-  'TimeParser.cxx',
-  'TimeConvert.cxx',
-  'TimeISO8601.cxx',
   'UriUtil.cxx',
   'LazyRandomEngine.cxx',
   'HugeAllocator.cxx',
diff --git a/test/run_storage.cxx b/test/run_storage.cxx
index 562b6d1e1..9db2215f4 100644
--- a/test/run_storage.cxx
+++ b/test/run_storage.cxx
@@ -22,7 +22,7 @@
 #include "storage/StorageInterface.hxx"
 #include "storage/FileInfo.hxx"
 #include "net/Init.hxx"
-#include "util/ChronoUtil.hxx"
+#include "time/ChronoUtil.hxx"
 #include "util/PrintException.hxx"
 
 #include <memory>
diff --git a/test/test_translate_song.cxx b/test/test_translate_song.cxx
index cac712785..8c2b41ebb 100644
--- a/test/test_translate_song.cxx
+++ b/test/test_translate_song.cxx
@@ -17,7 +17,7 @@
 #include "storage/StorageInterface.hxx"
 #include "storage/plugins/LocalStorage.hxx"
 #include "Mapper.hxx"
-#include "util/ChronoUtil.hxx"
+#include "time/ChronoUtil.hxx"
 
 #include <gtest/gtest.h>