Index: simplenews_digest.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simplenews_digest/simplenews_digest.module,v
retrieving revision 1.2
diff -u -p -r1.2 simplenews_digest.module
--- simplenews_digest.module	3 Jan 2009 20:45:03 -0000	1.2
+++ simplenews_digest.module	4 Jan 2009 05:11:48 -0000
@@ -244,21 +244,18 @@ function simplenews_digest_set_next_time
 
   // Calculate next day to send daily/weekly/monthly digests
   if ($frequency == 'daily') {
-    $next_day_to_send = gmmktime(0, 0, 0, gmdate("m", $adjusted_last_time_sent), gmdate('d', $adjusted_last_time_sent) + $interval, gmdate('Y', $adjusted_last_time_sent)); 
+    $approx_date_to_send_next = $adjusted_last_time_sent + ($interval * 86400);
+    $next_day_to_send = gmmktime(0, 0, 0, gmdate('m', $approx_date_to_send_next), gmdate('d', $approx_date_to_send_next), gmdate('Y', $approx_date_to_send_next)); 
   }
 
   if ($frequency == 'weekly') {
     $weekday = variable_get('simplenews_digest_weekday', 0);
     $approx_date_to_send_next = $adjusted_last_time_sent + ($interval * 86400 * 7);
-    $next_day_of_year_to_send = gmdate('z', $approx_date_to_send_next);
-    $next_day_of_week_to_send = gmdate('w', $approx_date_to_send_next);
-    if($weekday > $next_day_of_week_to_send) {
-      $next_day_of_year_to_send += $weekday - $next_day_of_week_to_send;
+//  Cycle back in days till we match the day we want
+    while (gmdate('w', $approx_date_to_send_next) != $weekday) {
+      $approx_date_to_send_next = $approx_date_to_send_next - 86400;  
     }
-    else {
-      $next_day_of_year_to_send -= $next_day_of_week_to_send - $weekday;
-    }
-    $next_day_to_send = gmmktime(0, 0, 0, 1, $next_day_of_year_to_send, gmdate('Y', $adjusted_last_time_sent));
+    $next_day_to_send = gmmktime(0, 0, 0, gmdate('m', $approx_date_to_send_next), gmdate('d', $approx_date_to_send_next), gmdate('Y', $approx_date_to_send_next));
   }
 
   if ($frequency == 'monthly') {
