Electroneum
epee::math_helper::once_a_time< scale, default_interval, start_immediate > Class Template Reference

#include <math_helper.h>

Public Member Functions

 once_a_time ()
 
template<class functor_t >
bool do_call (functor_t functr)
 

Detailed Description

template<uint64_t scale, int default_interval, bool start_immediate = true>
class epee::math_helper::once_a_time< scale, default_interval, start_immediate >

Definition at line 234 of file math_helper.h.

Constructor & Destructor Documentation

◆ once_a_time()

template<uint64_t scale, int default_interval, bool start_immediate = true>
epee::math_helper::once_a_time< scale, default_interval, start_immediate >::once_a_time ( )
inline

Definition at line 255 of file math_helper.h.

255  :m_interval(default_interval * scale)
256  {
257  m_last_worked_time = 0;
258  if(!start_immediate)
259  m_last_worked_time = get_time();
260  }

Member Function Documentation

◆ do_call()

template<uint64_t scale, int default_interval, bool start_immediate = true>
template<class functor_t >
bool epee::math_helper::once_a_time< scale, default_interval, start_immediate >::do_call ( functor_t  functr)
inline

Definition at line 263 of file math_helper.h.

264  {
265  uint64_t current_time = get_time();
266 
267  if(current_time - m_last_worked_time > m_interval)
268  {
269  bool res = functr();
270  m_last_worked_time = get_time();
271  return res;
272  }
273  return true;
274  }
const char * res
Definition: hmac_keccak.cpp:41
unsigned __int64 uint64_t
Definition: stdint.h:136
Here is the caller graph for this function:

The documentation for this class was generated from the following file: