? meta.patch
Index: usage/project-usage-process.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project/usage/project-usage-process.php,v
retrieving revision 1.7
diff -u -p -r1.7 project-usage-process.php
--- usage/project-usage-process.php	7 Aug 2009 15:42:32 -0000	1.7
+++ usage/project-usage-process.php	2 Jul 2010 22:35:21 -0000
@@ -116,7 +116,7 @@ cache_clear_all(NULL, 'cache_project_usa
  */
 function project_usage_process_daily() {
   // Timestamp for begining of the previous day.
-  $timestamp = project_usage_daily_timestamp(NULL, 1);
+  $timestamp = project_usage_daily_timestamp(NULL, -1);
   $time_0 = time();
 
   watchdog('project_usage', 'Starting to process daily usage data for !date.', array('!date' => format_date($timestamp, 'custom', 'Y-m-d')));
Index: usage/includes/date_api.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project/usage/includes/date_api.inc,v
retrieving revision 1.2
diff -u -p -r1.2 date_api.inc
--- usage/includes/date_api.inc	11 Apr 2009 22:42:34 -0000	1.2
+++ usage/includes/date_api.inc	2 Jul 2010 22:35:21 -0000
@@ -24,39 +24,37 @@ function project_usage_gmgetdate($timest
 }
 
 /**
- * Compute a timestamp for the beginning of a day N days ago.
+ * Compute a timestamp for the beginning of a day.
  *
  * @param $time
  *   Mixed, either a GMT timestamp or an array returned by
  *   project_usage_gmgetdate().
- * @param $days_ago
- *   An integer specifying a number of days previous. A value of 0 indicates
- *   the current day.
+ * @param $days_offset
+ *   An integer specifying an offset in days, in relation to the beginning of the day that $time falls in.
  *
  * @return
  *   GMT UNIX timestamp.
  */
-function project_usage_daily_timestamp($time = NULL, $days_ago = 0) {
+function project_usage_daily_timestamp($time = NULL, $days_offset = 0) {
   $time_parts = is_array($time) ? $time : project_usage_gmgetdate($time);
-  $day = $time_parts['mday'] - $days_ago;
+  $day = $time_parts['mday'] + $days_offset;
   return gmmktime(0, 0, 0, $time_parts['mon'], $day, $time_parts['year']);
 }
 
 /**
- * Compute a timestamp for the beginning of a week N weeks ago.
+ * Compute a timestamp for the beginning of a week.
  *
  * @param $time
  *   Mixed. Integer timestamp or an array returned by project_usage_gmgetdate().
- * @param $weeks_ago
- *   An integer specifying a number of weeks previous. A value of 0 indicates
- *   the current week.
+ * @param $weeks_offset
+ *   An integer specifying an offset in weeks, in relation to the beginning of the week that $time falls in.
  *
  * @return
  *   GMT UNIX timestamp.
  */
-function project_usage_weekly_timestamp($time = NULL, $weeks_ago = 0) {
+function project_usage_weekly_timestamp($time = NULL, $weeks_offset = 0) {
   $time_parts = is_array($time) ? $time : project_usage_gmgetdate($time);
-  $day = $time_parts['mday'] - $time_parts['wday'] + (7 * $weeks_ago);
+  $day = $time_parts['mday'] - $time_parts['wday'] + (7 * $weeks_offset);
   return gmmktime(0, 0, 0, $time_parts['mon'], $day, $time_parts['year']);
 }
 
@@ -127,4 +125,3 @@ function project_usage_get_current_activ
 function project_usage_cache_time() {
   return time() + variable_get('project_usage_cache_length', 86400);
 }
-
