diff --git a/cron.php b/cron.php
index e59c90e9827670682c15da9edf217d0192876b3a..acfb9507dc71153594e745c3e9069ce73a23a3f3 100644
--- a/cron.php
+++ b/cron.php
@@ -2,6 +2,20 @@
 
 include_once "includes/common.inc";
 
-foreach (module_list() as $module) module_invoke($module, "cron");
+/*
+** If not in 'safe mode', increase the maximum execution time:
+*/
+
+if (!get_cfg_var("safe_mode")) { 
+  set_time_limit(180);
+}
+
+/*
+** Iterate through the modules calling their cron handlers (if any):
+*/
+
+foreach (module_list() as $module) {
+  module_invoke($module, "cron");
+}
 
 ?>
\ No newline at end of file