Fix chrono comparisons in no-STL builds

This commit is contained in:
Firat Hajiyev 2026-10-15 20:06:24 -04:00
parent ea54954c54
commit 01580777f6
10 changed files with 43 additions and 10 deletions

View File

@ -211,7 +211,7 @@ namespace etl
//***********************************************************************
/// Spaceship operator
//***********************************************************************
#if ETL_USING_CPP20
#if ETL_USING_CPP20 && ETL_USING_STL
[[nodiscard]]
inline constexpr auto operator<=>(const etl::chrono::day& d1, const etl::chrono::day& d2) ETL_NOEXCEPT
{

View File

@ -482,7 +482,7 @@ namespace etl
//***********************************************************************
/// Spaceship operator
//***********************************************************************
#if ETL_USING_CPP20
#if ETL_USING_CPP20 && ETL_USING_STL
template <typename TRep1, typename TPeriod1, typename TRep2, typename TPeriod2>
[[nodiscard]]
constexpr auto operator<=>(const etl::chrono::duration<TRep1, TPeriod1>& lhs, const etl::chrono::duration<TRep2, TPeriod2>& rhs) ETL_NOEXCEPT

View File

@ -224,7 +224,7 @@ namespace etl
//***********************************************************************
/// Spaceship operator
//***********************************************************************
#if ETL_USING_CPP20
#if ETL_USING_CPP20 && ETL_USING_STL
[[nodiscard]]
inline constexpr auto operator<=>(const etl::chrono::month& d1, const etl::chrono::month& d2) ETL_NOEXCEPT
{

View File

@ -178,7 +178,7 @@ namespace etl
//***********************************************************************
/// Spaceship operator
//***********************************************************************
#if ETL_USING_CPP20
#if ETL_USING_CPP20 && ETL_USING_STL
[[nodiscard]]
inline constexpr auto operator<=>(const etl::chrono::month_day& lhs, const etl::chrono::month_day& rhs) ETL_NOEXCEPT
{
@ -298,7 +298,7 @@ namespace etl
//***********************************************************************
/// Spaceship operator
//***********************************************************************
#if ETL_USING_CPP20
#if ETL_USING_CPP20 && ETL_USING_STL
[[nodiscard]]
inline constexpr auto operator<=>(const etl::chrono::month_day_last& mdl1, const etl::chrono::month_day_last& mdl2) ETL_NOEXCEPT
{

View File

@ -353,7 +353,7 @@ namespace etl
//***********************************************************************
/// Spaceship operator
//***********************************************************************
#if ETL_USING_CPP20
#if ETL_USING_CPP20 && ETL_USING_STL
template <typename TClock, typename TDuration1, typename TDuration2>
[[nodiscard]]
constexpr auto operator<=>(const etl::chrono::time_point<TClock, TDuration1>& lhs, const etl::chrono::time_point<TClock, TDuration2>& rhs)

View File

@ -240,7 +240,7 @@ namespace etl
//***********************************************************************
/// Spaceship operator
//***********************************************************************
#if ETL_USING_CPP20
#if ETL_USING_CPP20 && ETL_USING_STL
[[nodiscard]]
inline constexpr auto operator<=>(const etl::chrono::year& y1, const etl::chrono::year& y2) ETL_NOEXCEPT
{

View File

@ -234,7 +234,7 @@ namespace etl
//***********************************************************************
/// Spaceship operator
//***********************************************************************
#if ETL_USING_CPP20
#if ETL_USING_CPP20 && ETL_USING_STL
[[nodiscard]]
inline constexpr auto operator<=>(const etl::chrono::year_month& lhs, const etl::chrono::year_month& rhs) ETL_NOEXCEPT
{

View File

@ -426,7 +426,7 @@ namespace etl
//***********************************************************************
/// Spaceship operator
//***********************************************************************
#if ETL_USING_CPP20
#if ETL_USING_CPP20 && ETL_USING_STL
[[nodiscard]]
inline constexpr auto operator<=>(const etl::chrono::year_month_day& lhs, const etl::chrono::year_month_day& rhs) ETL_NOEXCEPT
{
@ -722,7 +722,7 @@ namespace etl
//***********************************************************************
/// Spaceship operator
//***********************************************************************
#if ETL_USING_CPP20
#if ETL_USING_CPP20 && ETL_USING_STL
[[nodiscard]]
inline constexpr auto operator<=>(const etl::chrono::year_month_day_last& lhs, const etl::chrono::year_month_day_last& rhs) ETL_NOEXCEPT
{

View File

@ -134,6 +134,7 @@ target_sources(tests PRIVATE
char_traits.h.t.cpp
checksum.h.t.cpp
chrono.h.t.cpp
chrono_no_stl.h.t.cpp
concepts.h.t.cpp
const_map.h.t.cpp
const_multimap.h.t.cpp

View File

@ -0,0 +1,32 @@
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2026 J Wellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#if !defined(ETL_NO_STL)
#define ETL_NO_STL
#endif
#include <etl/chrono.h>