phpOpenTracker/phpOpenTracker/API/plugins access_statistics.php,1.7.2.1,1.7.2.2

Sebastian Bergmann <[email protected]>
Newsgroups gmane.comp.web.phpopentracker.cvs
Message-ID <[email protected]>
Update of /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/API/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv23781/phpOpenTracker/API/plugins

Modified Files:
      Tag: phpOpenTracker_1_3
	access_statistics.php 
Log Message:
MFH: Fix off-by-one-second bug in the phpOpenTracker API's Access Statistics plugin's interval calculation routine.

Index: access_statistics.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/API/plugins/Attic/access_statistics.php,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -C2 -d -r1.7.2.1 -r1.7.2.2
*** access_statistics.php	22 Dec 2003 03:36:57 -0000	1.7.2.1
--- access_statistics.php	31 Dec 2003 10:29:51 -0000	1.7.2.2
***************
*** 85,99 ****
        $end   = $parameters['end']   ? $parameters['end']   : time();
  
!       for ($i = $parameters['start']; $i < $parameters['end']; $i += $parameters['interval']) {
!         $correct = ((mktime(0, 0, 0, date('m', $i), date('d', $i) + 1, date('Y', $i))
!                    - mktime(0, 0, 0, date('m', $i), date('d', $i),     date('Y', $i)))
!                    * ($parameters['interval'] / 86400))
!                    - $parameters['interval'];
  
          $intervalStrings[] = sprintf(
            '%s - %s',
  
!           date('d-m-Y', $i),
!           date('d-m-Y', $i + $parameters['interval'] + $correct)
          );
  
--- 85,100 ----
        $end   = $parameters['end']   ? $parameters['end']   : time();
  
!       for ($startTimestamp = $start; $startTimestamp < $end; $startTimestamp += $parameters['interval']) {
!         $correct      = ((mktime(0, 0, 0, date('m', $startTimestamp), date('d', $startTimestamp) + 1, date('Y', $startTimestamp))
!                         - mktime(0, 0, 0, date('m', $startTimestamp), date('d', $startTimestamp),     date('Y', $startTimestamp)))
!                         * ($parameters['interval'] / 86400))
!                         - $parameters['interval'];
!         $endTimestamp = $startTimestamp + $parameters['interval'] + $correct - 1;
  
          $intervalStrings[] = sprintf(
            '%s - %s',
  
!           date('d-m-Y', $startTimestamp),
!           date('d-m-Y', $endTimestamp)
          );
  
***************
*** 102,114 ****
              'client_id'   => $parameters['client_id'],
              'api_call'    => $parameters['api_call'],
!             'start'       => $i,
!             'end'         => $i + $parameters['interval'] + $correct,
              'constraints' => $parameters['constraints']
            )
          );
  
!         $timestamps[] = $i;
! 
!         $i += $correct;
        }
      } else {
--- 103,114 ----
              'client_id'   => $parameters['client_id'],
              'api_call'    => $parameters['api_call'],
!             'start'       => $startTimestamp,
!             'end'         => $endTimestamp,
              'constraints' => $parameters['constraints']
            )
          );
  
!         $timestamps[]    = $startTimestamp;
!         $startTimestamp += $correct;
        }
      } else {




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.