aboutsummaryrefslogtreecommitdiff
path: root/utils/bandwidthd/patches/040-64bit-time-t.patch
blob: f0ddd586e45d0eb98a772c5b61b91c1bc78baa3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
--- a/bandwidthd.c
+++ b/bandwidthd.c
@@ -103,7 +103,7 @@ void bd_CollectingData(char *filename)
 		}
 	}
 
-int WriteOutWebpages(long int timestamp)
+int WriteOutWebpages(time_t timestamp)
 {
 	struct IPDataStore *DataStore = IPDataStore;
 	struct SummaryData **SummaryData;
@@ -893,7 +893,7 @@ void StoreIPDataInCDF(struct IPData IncD
 		{
 		IPData = &IncData[counter];
 		HostIp2CharIp(IPData->ip, IPBuffer);
-		fprintf(cdf, "%s,%lu,", IPBuffer, IPData->timestamp);
+		fprintf(cdf, "%s,%" PRId64 ",", IPBuffer, IPData->timestamp);
 		Stats = &(IPData->Send);
 		fprintf(cdf, "%llu,%llu,%llu,%llu,%llu,%llu,%llu,", Stats->total, Stats->icmp, Stats->udp, Stats->tcp, Stats->ftp, Stats->http, Stats->p2p); 
 		Stats = &(IPData->Receive);
@@ -1089,7 +1089,7 @@ int RCDF_Test(char *filename)
 		if (fseek(cdf, -2, SEEK_CUR) == -1)
 			break;
 		}
-	if(fscanf(cdf, " %15[0-9.],%lu,", ipaddrBuffer, &timestamp) != 2)
+	if(fscanf(cdf, " %15[0-9.],%" PRId64 ",", ipaddrBuffer, &timestamp) != 2)
 		{
 		syslog(LOG_ERR, "%s is corrupted, skipping", filename); 
 		return FALSE;
@@ -1122,7 +1122,7 @@ void RCDF_PositionStream(FILE *cdf)
 			}
 		while (fgetc(cdf) != '\n' && !feof(cdf)); // Read to next line
 		ungetc('\n', cdf);  // Just so the fscanf mask stays identical
-        if(fscanf(cdf, " %15[0-9.],%lu,", ipaddrBuffer, &timestamp) != 2)
+        if(fscanf(cdf, " %15[0-9.],%" PRId64 ",", ipaddrBuffer, &timestamp) != 2)
 			{
 			syslog(LOG_ERR, "Unknown error while scanning for beginning of data...\n");
 			return;	
@@ -1144,7 +1144,7 @@ void RCDF_Load(FILE *cdf)
 
     for(Counter = 0; !feof(cdf) && !ferror(cdf); Counter++)
 	    {
-		if(fscanf(cdf, " %15[0-9.],%lu,", ipaddrBuffer, &timestamp) != 2) 
+		if(fscanf(cdf, " %15[0-9.],%" PRId64 ",", ipaddrBuffer, &timestamp) != 2)
 			goto End_RecoverDataFromCdf;
 
 		if (!timestamp) // First run through loop
--- a/graph.c
+++ b/graph.c
@@ -767,8 +767,8 @@ void PrepareXAxis(gdImagePtr im, time_t
     int black, red;
     time_t sample_begin, sample_end;    
     struct tm *timestruct;
-    long int MarkTime;
-	long int MarkTimeStep;
+    time_t MarkTime;
+    time_t MarkTimeStep;
     double x;
     
     sample_begin=timestamp-config.range;
@@ -786,7 +786,7 @@ void PrepareXAxis(gdImagePtr im, time_t
 	if ((24*60*60*(XWIDTH-XOFFSET))/config.range > (XWIDTH-XOFFSET)/10)
 		{
 		// Day bars
-	    timestruct = localtime((time_t *)&sample_begin);
+	    timestruct = localtime(&sample_begin);
     	timestruct->tm_sec = 0;
 	    timestruct->tm_min = 0;
     	timestruct->tm_hour = 0;
@@ -805,7 +805,7 @@ void PrepareXAxis(gdImagePtr im, time_t
 	        gdImageLine(im, x, 0, x, YHEIGHT-YOFFSET, red);
     	    gdImageLine(im, x+1, 0, x+1, YHEIGHT-YOFFSET, red);
 	
-    	    timestruct = localtime((time_t *)&MarkTime);
+    	    timestruct = localtime(&MarkTime);
 	        strftime(buffer, 100, "%a, %b %d", timestruct);
     	    gdImageString(im, gdFontSmall, x-30,  YHEIGHT-YOFFSET+10, buffer, black);        
 
@@ -817,7 +817,7 @@ void PrepareXAxis(gdImagePtr im, time_t
 	else
 		{
     	// Month Bars
-        timestruct = localtime((time_t *)&sample_begin);
+        timestruct = localtime(&sample_begin);
         timestruct->tm_sec = 0;
         timestruct->tm_min = 0;
         timestruct->tm_hour = 0;
@@ -839,7 +839,7 @@ void PrepareXAxis(gdImagePtr im, time_t
 	        gdImageLine(im, x, 0, x, YHEIGHT-YOFFSET, red);
     	    gdImageLine(im, x+1, 0, x+1, YHEIGHT-YOFFSET, red);
 	
-    	    timestruct = localtime((time_t *)&MarkTime);
+    	    timestruct = localtime(&MarkTime);
 	        strftime(buffer, 100, "%b", timestruct);
     	    gdImageString(im, gdFontSmall, x-6,  YHEIGHT-YOFFSET+10, buffer, black);        
 
@@ -854,7 +854,7 @@ void PrepareXAxis(gdImagePtr im, time_t
     // ****  Write the tic marks
     // ********************************************************************
 
-    timestruct = localtime((time_t *)&sample_begin);
+    timestruct = localtime(&sample_begin);
     timestruct->tm_sec = 0;
     timestruct->tm_min = 0;
     timestruct->tm_hour = 0;
@@ -884,7 +884,7 @@ void PrepareXAxis(gdImagePtr im, time_t
    		x = (MarkTime-sample_begin)*((XWIDTH-XOFFSET)/config.range) + XOFFSET;
         }
 
-    timestruct = localtime((time_t *)&sample_begin);
+    timestruct = localtime(&sample_begin);
     timestruct->tm_sec = 0;
     timestruct->tm_min = 0;
     timestruct->tm_hour = 0;