Prophidys / RTG2

Realtime Traffic Grapher 2
GNU General Public License v2.0
11 stars 9 forks source link

Week Graphs are off by one Day-of-week. #11

Closed Prophidys closed 9 years ago

Prophidys commented 9 years ago

From flintroc...@gmail.com on February 10, 2010 16:39:49

What steps will reproduce the problem? 1. Generating (MRTG like) graphs via the view.php for an individual port. i.e. https://rtg.mysite.com/rtg/view.php?rid=1&iid=8 What is the expected output? What do you see instead? Expected: current-day of week back to 1 week prior. For example if today is Thursday, I expect graph to display Last Friday through current day, Thursday.

Displayed: If current day of week is Thursday, the graph displays Friday back to Saturday. But the data is actually for Thursday back to Friday. The display is one day off. Displayed "Friday" is actually Thursday data. I did not notice this until we got into February, 2010. The data is actually for the current day in the graph it seems, it is just the generation of the Day-of-week label that is off by one. Again I only noticed this when we got to February, 2010. What version of the product are you using? On what operating system? Version: v.0.9.0 with patch applied for issue #8 "throughput seems lower than reality".

Linux: CentOS 5.4 Please provide any additional information below. Will attach graphs to illustrate..

Original issue: http://code.google.com/p/rtg2/issues/detail?id=11

Prophidys commented 9 years ago

From flintroc...@gmail.com on February 11, 2010 13:44:25

The screenshot was taken on Thu Feb 11 21:41:59 UTC 2010 Notice how it includes Friday as the current day. The localtime is set to UTC on the host.

Attachment: Screen shot 2010-02-11 at 2.41.59 PM.png

Prophidys commented 9 years ago

From ced.leco...@gmail.com on January 26, 2012 08:39:12

Maybe with this :

char *dayofweek[7]={"Sat","Sun","Mon","Tue","Wed","Thu","Fri"};

In place of :

char *dayofweek[7]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};

It's dirty but it's a temporary fix until i found the problem.

Prophidys commented 9 years ago

From ced.leco...@gmail.com on January 26, 2012 08:39:49

Sorry, in rtgplot.c line 961

Prophidys commented 9 years ago

From ced.leco...@gmail.com on January 26, 2012 12:08:51

Owner: ced.leco...@gmail.com

Prophidys commented 9 years ago

From ced.leco...@gmail.com on January 26, 2012 12:47:48

I think i have the solution,

In example for the month scale the month increment take place after the printing of label on the graph but in the case of a day scale the increment take place at start and we have graph off by one day of week.

With the correct place of the increment :

if (i % coeff == 0 ) { // seconds += 86400; thetime = localtime(&seconds); if (set->verbose >= HIGH) fprintf(dfp, "Labeling %d %d %d:%d:%d as %s.\n", seconds,thetime->tm_wday, thetime->tm_hour,thetime->tm_min,thetime->tm_sec, dayofweek[thetime->tm_wday]); snprintf(string, sizeof(string),"%s",dayofweek[thetime->tm_wday]); gdImageString(img, gdFontSmall,(coeff(graph->image.xplotarea-skip))/xticks/2 +(i(graph->image.xplot_area-skip))/xticks + skip + BORDER_L -7 , BORDER_T + graph->image.yplot_area +5, string, std_colors[black]); gdImageSetStyle(_img, styleDottedDark, 3); seconds += 86400; } else {

With this arguments : ?PO=Traffic+In/Out:800:200:factor%3D8%2Cunits%3Dbits:1326200000:1327000000&DO=0:ifOutOctets_64:1217&LO=0:0:factor=8,units=bits:ifOutOctets&DO=1:ifInOctets_64:1217&LO=1:1:factor=8,units=bits:ifInOctets

1326200000 = Tue 10/1/2012 à 13:53:20 1327000000 = Thu 19/1/2012 à 20:06:40

We have the right graph in attach.

I Will commit the fix and close the issue.

Attachment: rtgplot.cgi.png

Prophidys commented 9 years ago

From ced.leco...@gmail.com on January 26, 2012 12:54:00

Problem fix in rev22

Status: Fixed