Index: trunk/MagicSoft/Mars/datacenter/macros/plotstat.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/plotstat.C	(revision 7542)
+++ trunk/MagicSoft/Mars/datacenter/macros/plotstat.C	(revision 7558)
@@ -337,5 +337,5 @@
     MTime from;
 
-    while (past<now)
+    while (1)
     {
         if (past.GetMagicPeriod()!=period)
@@ -343,5 +343,5 @@
             period = past.GetMagicPeriod();
 
-            if (period>=first && period<=last)
+            if (period>first && period-1<=last)
             {
                 TString a = from.GetSqlDateTime();
@@ -349,6 +349,9 @@
 
                 for (int i=0; i<8; i++)
-                    h[i].Fill(period, GetTime(serv, query[i], a, b));
+                    h[i].Fill(period-1, GetTime(serv, query[i], a, b));
             }
+
+            if (past>now)
+                break;
 
             from = past;
