diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12f6a2ce..0292e45f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,8 +5,9 @@ on: branches: [main, dev] env: - BRANCH: "main" + BRANCH: "feature/RB-61-basic-missiles" RAYLIB_TAG: "4.5.0" + DATE_TAG: "v3.0.1" jobs: release-create: @@ -37,7 +38,7 @@ jobs: release-windows: runs-on: windows-latest - needs: [release-create, raylib-to-tar] + needs: [release-create, raylib-to-tar, date-to-tar] steps: - name: Checkout @@ -78,7 +79,7 @@ jobs: release-linux: runs-on: ubuntu-latest - needs: [release-create, raylib-to-tar] + needs: [release-create, raylib-to-tar, date-to-tar] steps: - name: Checkout @@ -114,7 +115,7 @@ jobs: release-macos: runs-on: macos-latest - needs: [release-create, raylib-to-tar] + needs: [release-create, raylib-to-tar, date-to-tar] steps: - name: Checkout @@ -183,3 +184,39 @@ jobs: with: name: raylib.tar path: ./raylib.tar + + date-to-tar: + runs-on: ubuntu-latest + needs: release-create + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install deps + run: sudo apt-get update && sudo apt-get install -y tar git + + - name: Get Date + run: | + git clone https://github.com/HowardHinnant/date.git date-repo + cd date-repo || exit 14 + git checkout ${{ env.DATE_TAG }} + cd .. + + - name: To Tar + run: | + tar -cvf date.tar date-repo + + - name: Upload To Release + if: github.ref == 'refs/heads/main' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release upload ${{ needs.release-create.outputs.release }} ./date.tar + + - name: Upload To Artifact + if: github.ref != 'refs/heads/main' + uses: actions/upload-artifact@v3 + with: + name: date.tar + path: ./date.tar diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index cb2a6b9a..a29e98ff 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -2,3 +2,4 @@ cmake_minimum_required(VERSION 3.15) add_subdirectory(raylib) add_subdirectory(boost) +add_subdirectory(date) diff --git a/deps/date/CMakeLists.txt b/deps/date/CMakeLists.txt new file mode 100644 index 00000000..3118c6f6 --- /dev/null +++ b/deps/date/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.15) + +include(FetchContent) + +FetchContent_Declare( + date + CMAKE_ARGS "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_CONFIGURATION_TYPES=\"Release;Release\"" "-DCONFIG=Release" + URL "https://github.com/X-R-G-B/R-Bus/releases/latest/download/date.tar" + DOWNLOAD_EXTRACT_TIMESTAMP TRUE +) + +FetchContent_MakeAvailable(date) + +target_include_directories( + ${PROJECT_NAME_CLIENT} + PRIVATE + ${date_SOURCE_DIR}/include +) + +target_include_directories( + ${PROJECT_NAME_SERVER} + PRIVATE + ${date_SOURCE_DIR}/include +) diff --git a/src/ECS/Logger.cpp b/src/ECS/Logger.cpp index 44722482..e72e3185 100644 --- a/src/ECS/Logger.cpp +++ b/src/ECS/Logger.cpp @@ -11,6 +11,9 @@ #include #include #include "Registry.hpp" +#include "date/date.h" +#include +#include namespace Logger { void fatal(const std::string &message) @@ -135,13 +138,13 @@ namespace Logger { }; #endif - auto const now = std::chrono::get_tzdb().current_zone()->to_local( - std::chrono::system_clock::now()); - std::string mes; + auto const now = std::chrono::system_clock::now(); auto it = _callbacks.find(levelT); + std::stringstream s; + std::string mes; - mes = std::format("{:%Y-%m-%d %H:%M:%S}", now) + " [" + level + "] " - + message; + s << now << " [" << level << "] " << message; + mes = s.str(); std::cerr << colors[levelT] << mes << colors[LogLevel::MAXLOGLEVEL] << std::endl; if (it != _callbacks.end()) {