Skip to content

Commit 7f7289a

Browse files
New time_utils function: the_beginning_of_time (#50)
Signed-off-by: Juan López Fernández <juanlopez@eprosima.com>
1 parent e9ecdb3 commit 7f7289a

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

cpp_utils/include/cpp_utils/time/time_utils.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ using Timestamp = std::chrono::time_point<std::chrono::system_clock>;
4242
CPP_UTILS_DllAPI Timestamp now() noexcept;
4343

4444
//! Returns the maximum time available for \c Timestamp
45-
CPP_UTILS_DllAPI Timestamp the_end_of_times() noexcept;
45+
CPP_UTILS_DllAPI Timestamp the_end_of_time() noexcept;
46+
47+
//! Returns the minimum time available for \c Timestamp
48+
CPP_UTILS_DllAPI Timestamp the_beginning_of_time() noexcept;
4649

4750
CPP_UTILS_DllAPI Timestamp date_to_timestamp(
4851
unsigned int year,

cpp_utils/include/cpp_utils/wait/impl/WaitHandler.ipp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ std::unique_lock<std::mutex> WaitHandler<T>::blocking_wait_(
147147
}
148148
else
149149
{
150-
time_to_wait_until = utils::the_end_of_times();
150+
time_to_wait_until = utils::the_end_of_time();
151151
}
152152

153153
bool finished_for_condition_met = wait_condition_variable_.wait_until(

cpp_utils/src/cpp/time/time_utils.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,16 @@ Timestamp now() noexcept
3838
return std::chrono::system_clock::now();
3939
}
4040

41-
Timestamp the_end_of_times() noexcept
41+
Timestamp the_end_of_time() noexcept
4242
{
4343
return std::chrono::time_point<std::chrono::system_clock>::max();
4444
}
4545

46+
Timestamp the_beginning_of_time() noexcept
47+
{
48+
return std::chrono::time_point<std::chrono::system_clock>::min();
49+
}
50+
4651
Timestamp date_to_timestamp(
4752
unsigned int year,
4853
unsigned int month,

0 commit comments

Comments
 (0)