- nowdeltastr_cpy = xbt_strdup(nowdeltastr);
- valuestr_cpy = xbt_strdup(valuestr);
- variable_cpy = xbt_strdup(variable);
- xbt_dict_set(method_b_dict, timekey, nowdeltastr_cpy, xbt_free);
- xbt_dict_set(method_b_dict, valuekey, valuestr_cpy, xbt_free);
- xbt_dict_set(method_b_dict, variablekey, variable_cpy, xbt_free);
- } else {
- lasttime = xbt_dict_get_or_null(method_b_dict, timekey);
- lastvalue = xbt_dict_get_or_null(method_b_dict, valuekey);
-
- /* check if it is the same variable */
- if (strcmp(lastvariable, variable) == 0) { /* same variable */
- /* check if lasttime equals now */
- if (atof(lasttime) == now) { /* lastime == now */
- /* check if lastvalue equals valuestr */
- if (atof(lastvalue) == value) { /* lastvalue == value (good, just advance time) */
- char *nowdeltastr_cpy = xbt_strdup(nowdeltastr);
- xbt_dict_set(method_b_dict, timekey, nowdeltastr_cpy, xbt_free);
- } else { /* value has changed */
- /* value has changed, subtract previous value, add new one */
- pajeSubVariable(atof(lasttime), variable, resource, lastvalue);
- pajeAddVariable(atof(nowstr), variable, resource, valuestr);
- nowdeltastr_cpy = xbt_strdup(nowdeltastr);
- valuestr_cpy = xbt_strdup(valuestr);
- xbt_dict_set(method_b_dict, timekey, nowdeltastr_cpy, xbt_free);
- xbt_dict_set(method_b_dict, valuekey, valuestr_cpy, xbt_free);
- }
- } else { /* lasttime != now */
- /* the last time is different from new starting time, subtract to lasttime and add from nowstr */
- pajeSubVariable(atof(lasttime), variable, resource, lastvalue);
- pajeAddVariable(atof(nowstr), variable, resource, valuestr);
- nowdeltastr_cpy = xbt_strdup(nowdeltastr);
- valuestr_cpy = xbt_strdup(valuestr);
- xbt_dict_set(method_b_dict, timekey, nowdeltastr_cpy, xbt_free);
- xbt_dict_set(method_b_dict, valuekey, valuestr_cpy, xbt_free);
+ xbt_dict_set(method_b_dict, key_time, xbt_strdup(nowdeltastr), xbt_free);
+ xbt_dict_set(method_b_dict, key_value, xbt_strdup(valuestr), xbt_free);
+ }else{
+ double lasttime = atof (lasttimestr);
+ double lastvalue = atof (lastvaluestr);
+
+ if (lastvalue == value){
+ double dif = fabs(now - lasttime);
+ if (dif < 0.000001){
+ //perfect, just go on
+ }else{
+ //time changed, have to update
+ pajeSubVariable(lasttime, variable, resource, lastvaluestr);
+ pajeAddVariable(now, variable, resource, valuestr);