ADD_DEFINITIONS("-DDEFAULT_MASTER_CONF=\"/usr/share/data-provider-master/conf.ini\"")
ADD_DEFINITIONS("-DNDEBUG")
+
+ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET")
#ADD_DEFINITIONS("-DFLOG")
ADD_DEFINITIONS(${pkg_CFLAGS})
ADD_DEFINITIONS(${pkg_LDFLAGS})
int minor;
} width;
int distance; /* Hovering */
+#if defined(_USE_ECORE_TIME_GET)
+ double tv;
+#else
struct timeval tv;
+#endif
};
enum event_state {
Name: data-provider-master
Summary: Master service provider for liveboxes.
-Version: 0.25.14
+Version: 0.25.15
Release: 1
Group: HomeTF/Livebox
License: Flora License
enum event_state state;
+#if defined(_USE_ECORE_TIME_GET)
+ double tv;
+#else
struct timeval tv; /* Recording Activate / Deactivate time */
+#endif
int x; /* RelX */
int y; /* RelY */
};
if (item) {
char event_ch = EVENT_CH;
+#if defined(_USE_ECORE_TIME_GET)
+ s_info.event_data.tv = ecore_time_get();
+#else
if (gettimeofday(&s_info.event_data.tv, NULL) < 0) {
ErrPrint("gettimeofday: %s\n", strerror(errno));
}
+#endif
memcpy(item, &s_info.event_data, sizeof(*item));
EINA_LIST_FOREACH_SAFE(s_info.event_listener_list, l, n, listener) {
switch (listener->state) {
case EVENT_STATE_ACTIVATE:
+#if defined(_USE_ECORE_TIME_GET)
+ if (listener->tv > item->tv) {
+ continue;
+ }
+#else
if (timercmp(&listener->tv, &item->tv, >)) {
/* Ignore previous events before activating this listener */
continue;
}
+#endif
next_state = EVENT_STATE_ACTIVATED;
cur_state = listener->state;
break;
case EVENT_STATE_DEACTIVATE:
+#if defined(_USE_ECORE_TIME_GET)
+ if (listener->tv > item->tv) {
+ /* Consuming all events occurred while activating this listener */
+ cur_state = EVENT_STATE_ACTIVATED;
+ next_state = EVENT_STATE_ACTIVATED;
+ break;
+ }
+#else
if (timercmp(&listener->tv, &item->tv, >)) {
/* Consuming all events occurred while activating this listener */
cur_state = EVENT_STATE_ACTIVATED;
next_state = EVENT_STATE_ACTIVATED;
break;
}
+#endif
cur_state = listener->state;
next_state = EVENT_STATE_DEACTIVATED;
return LB_STATUS_ERROR_MEMORY;
}
+#if defined(_USE_ECORE_TIME_GET)
+ listener->tv = ecore_time_get();
+#else
if (gettimeofday(&listener->tv, NULL) < 0) {
ErrPrint("gettimeofday: %s\n", strerror(errno));
DbgFree(listener);
return LB_STATUS_ERROR_FAULT;
}
+#endif
listener->event_cb = event_cb;
listener->cbdata = data;
static inline void timer_freeze(struct inst_info *inst)
{
- struct timeval tv;
ecore_timer_freeze(inst->update_timer);
if (ecore_timer_interval_get(inst->update_timer) <= 1.0f) {
return;
}
+#if defined(_USE_ECORE_TIME_GET)
+ inst->sleep_at = ecore_time_get();
+#else
+ struct timeval tv;
if (gettimeofday(&tv, NULL) < 0) {
ErrPrint("gettimeofday: %s\n", strerror(errno));
tv.tv_sec = 0;
tv.tv_usec = 0;
}
inst->sleep_at = (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f;
+#endif
}
Ecore_Timer *relaunch_timer; /* Try to relaunch service app */
int relaunch_count;
+#if defined(_USE_ECORE_TIME_GET)
+ double activated_at;
+#else
struct timeval activated_at;
+#endif
};
struct event {
slave_set_reactivation(slave, 0);
slave_set_reactivate_instances(slave, 0);
+#if defined(_USE_ECORE_TIME_GET)
+ slave->activated_at = ecore_time_get();
+#else
if (gettimeofday(&slave->activated_at, NULL) < 0) {
ErrPrint("Failed to get time of day: %s\n", strerror(errno));
slave->activated_at.tv_sec = 0;
slave->activated_at.tv_usec = 0;
}
+#endif
if (slave->activate_timer) {
ecore_timer_del(slave->activate_timer);
HAPI struct slave_node *slave_deactivated_by_fault(struct slave_node *slave)
{
int ret;
- struct timeval faulted_at;
int reactivate = 1;
int reactivate_instances = 1;
}
}
+#if defined(_USE_ECORE_TIME_GET)
+ double faulted_at;
+
+ faulted_at = ecore_time_get();
+ if (faulted_at - slave->activated_at < MINIMUM_REACTIVATION_TIME) {
+ slave->critical_fault_count++;
+ if (!slave_loaded_instance(slave) || slave->critical_fault_count >= SLAVE_MAX_LOAD) {
+ ErrPrint("Reactivation time is too fast and frequently occurred - Stop to auto reactivation\n");
+ reactivate = 0;
+ reactivate_instances = 0;
+ slave->critical_fault_count = 0;
+ /*!
+ * \note
+ * Fault callback can access the slave information.
+ */
+ invoke_fault_cb(slave);
+ } else {
+ slave->critical_fault_count = 0;
+ }
+ } else {
+ ErrPrint("Failed to get time of day: %s\n", strerror(errno));
+ }
+#else
+ struct timeval faulted_at;
+
if (gettimeofday(&faulted_at, NULL) == 0) {
struct timeval rtv;
} else {
ErrPrint("Failed to get time of day: %s\n", strerror(errno));
}
+#endif
slave_set_reactivation(slave, reactivate);
slave_set_reactivate_instances(slave, reactivate_instances);
HAPI double util_timestamp(void)
{
+#if defined(_USE_ECORE_TIME_GET)
+ return ecore_time_get();
+#else
struct timeval tv;
-
if (gettimeofday(&tv, NULL) < 0) {
static unsigned long internal_count = 0;
ErrPrint("failed to get time of day: %s\n", strerror(errno));
}
return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f;
+#endif
}
HAPI int util_check_ext(const char *filename, const char *check_ptr)
HAPI double util_time_delay_for_compensation(double period)
{
- struct timeval tv;
unsigned long long curtime;
unsigned long long _period;
unsigned long long remain;
return 0.0f;
}
+#if defined(_USE_ECORE_TIME_GET)
+ double tv;
+ tv = ecore_time_get();
+ curtime = tv * 1000000llu;
+#else
+ struct timeval tv;
if (gettimeofday(&tv, NULL) < 0){
ErrPrint("gettimeofday: %s\n", strerror(errno));
return period;
}
curtime = (unsigned long long)tv.tv_sec * 1000000llu + (unsigned long long)tv.tv_usec;
+#endif
+
_period = (unsigned long long)(period * (double)1000000);
if (_period == 0llu) {
ErrPrint("%lf <> %llu\n", period, _period);