Code

patches: Added bts332766-negative-timestamps.
[pkg-rrdtool.git] / debian / patches / bts332766-negative-timestamps
1 diff a/src/rrd_update.c b/src/rrd_update.c
2 --- a/src/rrd_update.c
3 +++ b/src/rrd_update.c
4 @@ -972,6 +972,11 @@ static int get_time_from_reading(
5              return -1;
6          };
7          setlocale(LC_NUMERIC, old_locale);
8 +        if (tmp < 0.0){
9 +            gettimeofday(&tmp_time, 0);
10 +            tmp = (double)tmp_time.tv_sec + (double)tmp_time.tv_usec * 1e-6f + tmp;
11 +        }
12 +
13          *current_time = floor(tmp);
14          *current_time_usec = (long) ((tmp - (double) *current_time) * 1e6f);
15      }