]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Ported r188 from branches/v2_2_6_1 (graphs label)
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Wed, 6 Jan 2010 08:51:58 +0000 (08:51 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Wed, 6 Jan 2010 08:51:58 +0000 (08:51 +0000)
grepday.c
totday.c

index 7d5455ae537295a45a26a57f018079ba4248e8e6..6cc96d1d126ad11198fb48551f81b58113623509 100644 (file)
--- a/grepday.c
+++ b/grepday.c
@@ -377,7 +377,10 @@ void greport_day(const char *user)
    SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 88,"   3G");
    SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 78,"   4G");
    SARGgdImageStringFT(im,&brect[0],dimgray,font1,7,0.0,23, 68,"   5G");
-   SARGgdImageStringFT(im,&brect[0],black,font1,10,3.14/2,20,248,text[93]);
+   if(strcmp(datetimeby,"bytes") == 0)
+      SARGgdImageStringFT(im,&brect[0],black,font1,10,3.14/2,20,248,text[93]);
+   else
+      SARGgdImageStringFT(im,&brect[0],black,font1,10,3.14/2,20,248,text[94]);
    SARGgdImageStringFT(im,&brect[0],black,font1,10,0.0,330,460,text[127]);
 
    if (snprintf(graph,sizeof(graph),"%s/%s/graph_day.png",dirname,user)>=sizeof(graph)) {
index ce46c53c44bf361f735e727b070dbe26b0e5ef37..1e8ebbf90f913f1e32aed10df21eb2273b5993fc 100644 (file)
--- a/totday.c
+++ b/totday.c
@@ -38,15 +38,12 @@ void day_totalize(const char *tmp, const char *user, int indexonly)
    char odata[20];
    char ohora[20];
    char oelap[20];
-   char hm[20];
-   char ohm[20];
    char csort[255];
    char wdirname[MAXLEN];
    char sortout[MAXLEN];
    char arqout[MAXLEN];
    int  regs=0;
    long long int telap=0;
-   long long int tused=0;
    int cstatus;
    struct getwordstruct gwarea;
 
@@ -81,46 +78,30 @@ void day_totalize(const char *tmp, const char *user, int indexonly)
       fixendofline(buf);
       getword_start(&gwarea,buf);
       if (getword(data,sizeof(data),&gwarea,'\t')<0 || getword(hora,sizeof(hora),&gwarea,':')<0 ||
-          getword(min,sizeof(min),&gwarea,':')<0 || getword(elap,sizeof(elap),&gwarea,'\t')<0 ||
+          getword(min,sizeof(min),&gwarea,':')<0 || getword_skip(20,&gwarea,'\t')<0 ||
           getword(elap,sizeof(elap),&gwarea,0)<0) {
          printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",sortout);
          exit(1);
       }
-      sprintf(hm,"%s%s",hora,min);
 
       if(!regs) {
          strcpy(odata,data);
          strcpy(ohora,hora);
          strcpy(oelap,elap);
-         strcpy(ohm,hm);
          regs++;
       }
 
       if(strcmp(hora,ohora) != 0 || strcmp(data,odata) != 0) {
-         if(tused > telap)
-            tused=telap;
-
          my_lltoa(telap,val1,15);
          fprintf(fp_ou,"%s\t%s\t%s\n",odata,ohora,val1);
          strcpy(odata,data);
          strcpy(ohora,hora);
-         strcpy(ohm,hm);
          telap=0;
-         tused=0;
-      }
-
-      if(strcmp(ohm,hm) != 0) {
-         tused+=60000;
-         strcpy(ohm,hm);
       }
 
       telap+=my_atoll(elap);
-
    }
 
-   if(tused > telap)
-      tused=telap;
-
    my_lltoa(telap,val1,15);
    fprintf(fp_ou,"%s\t%s\t%s\n",data,hora,val1);