You are here

function acquia_lift_adjust_report_start_date in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 acquia_lift.admin.inc \acquia_lift_adjust_report_start_date()

Adjusts the start time so that the time interval is within the max.

Parameters

int $start: Timestamp representing the start date for the report.

int $end: Timestamp representing the end date for the report.

Return value

int The adjusted start date as a timestamp.

1 call to acquia_lift_adjust_report_start_date()
acquia_lift_get_report_dates_for_agent in ./acquia_lift.admin.inc
Returns an array with start date and end date in Y-m-d format.

File

./acquia_lift.admin.inc, line 854
acquia_lift.admin.inc Provides functions needed for the admin UI.

Code

function acquia_lift_adjust_report_start_date($start, $end) {
  $num_days = floor(($end - $start) / 86400);
  $max_days = variable_get('acquia_lift_report_max_days', 14);
  if ($num_days <= $max_days) {
    return $start;
  }

  // Move the start date forward so that we are within the max.
  $num_seconds = $max_days * 86400;
  return $end - $num_seconds;
}