time: changes to support 64bit time
Upstream changed the default of the time_t definition to go from 32bit
to 64bit. Utilize the std::chrono::duration class to abstract the max.
Tested:
- Confirmed it compiles with latest yocto
Change-Id: I53096d976bfa9fcd74faf8ebac9dccf204264aa6
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/scheduled_host_transition.cpp b/scheduled_host_transition.cpp
index 8ae81d2..f7c04a0 100644
--- a/scheduled_host_transition.cpp
+++ b/scheduled_host_transition.cpp
@@ -22,9 +22,6 @@
#define TFD_TIMER_CANCEL_ON_SET (1 << 1)
#endif
-// Needed to make sure timerfd does not misfire even though we set CANCEL_ON_SET
-#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
-
namespace phosphor
{
namespace state
@@ -130,8 +127,8 @@
// Subscribe time change event
// Choose the MAX time that is possible to avoid mis fires.
constexpr itimerspec maxTime = {
- {0, 0}, // it_interval
- {TIME_T_MAX, 0}, // it_value
+ {0, 0}, // it_interval
+ {system_clock::duration::max().count(), 0}, // it_value
};
// Create and operate on a timer that delivers timer expiration