Index: t3lib/config_default.php
===================================================================
--- t3lib/config_default.php	(revision 3011)
+++ t3lib/config_default.php	(working copy)
@@ -462,4 +462,7 @@
 	// Setting some global vars:
 $EXEC_TIME = time();					// $EXEC_TIME is set so that the rest of the script has a common value for the script execution time
 $SIM_EXEC_TIME = $EXEC_TIME;			// $SIM_EXEC_TIME is set to $EXEC_TIME but can be altered later in the script if we want to simulate another execution-time when selecting from eg. a database
+$ACCESS_TIME = $EXEC_TIME - ($EXEC_TIME % 60);		// $ACCESS_TIME is a common time in minutes for access control
+$SIM_ACCESS_TIME = $SIM_ACCESS_TIME;		// if $SIM_EXEC_TIME is changed this value must be set accordingly
+
 ?>
Index: t3lib/class.t3lib_befunc.php
===================================================================
--- t3lib/class.t3lib_befunc.php	(revision 3009)
+++ t3lib/class.t3lib_befunc.php	(working copy)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -406,7 +406,7 @@
 	 * Backend implementation of enableFields()
 	 * Notice that "fe_groups" is not selected for - only disabled, starttime and endtime.
 	 * Notice that deleted-fields are NOT filtered - you must ALSO call deleteClause in addition.
-	 * $GLOBALS["SIM_EXEC_TIME"] is used for date.
+	 * $GLOBALS["SIM_ACCESS_TIME"] is used for date.
 	 * Usage: 5
 	 *
 	 * @param	string		$table is the table from which to return enableFields WHERE clause. Table name must have a 'ctrl' section in $TCA.
@@ -426,13 +426,13 @@
 				}
 				if ($ctrl['enablecolumns']['starttime'])	{
 					$field = $table.'.'.$ctrl['enablecolumns']['starttime'];
-					$query[]='('.$field.'<='.$GLOBALS['SIM_EXEC_TIME'].')';
-					$invQuery[]='('.$field.'!=0 AND '.$field.'>'.$GLOBALS['SIM_EXEC_TIME'].')';
+					$query[]='('.$field.'<='.$GLOBALS['SIM_ACCESS_TIME'].')';
+					$invQuery[]='('.$field.'!=0 AND '.$field.'>'.$GLOBALS['SIM_ACCESS_TIME'].')';
 				}
 				if ($ctrl['enablecolumns']['endtime'])	{
 					$field = $table.'.'.$ctrl['enablecolumns']['endtime'];
-					$query[]='('.$field.'=0 OR '.$field.'>'.$GLOBALS['SIM_EXEC_TIME'].')';
-					$invQuery[]='('.$field.'!=0 AND '.$field.'<='.$GLOBALS['SIM_EXEC_TIME'].')';
+					$query[]='('.$field.'=0 OR '.$field.'>'.$GLOBALS['SIM_ACCESS_TIME'].')';
+					$invQuery[]='('.$field.'!=0 AND '.$field.'<='.$GLOBALS['SIM_ACCESS_TIME'].')';
 				}
 			}
 		}
Index: t3lib/class.t3lib_page.php
===================================================================
--- t3lib/class.t3lib_page.php	(revision 3009)
+++ t3lib/class.t3lib_page.php	(working copy)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2007 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -141,7 +141,7 @@
 		if (!$show_hidden)	{
 			$this->where_hid_del.= 'AND pages.hidden=0 ';
 		}
-		$this->where_hid_del.= 'AND (pages.starttime<='.$GLOBALS['SIM_EXEC_TIME'].') AND (pages.endtime=0 OR pages.endtime>'.$GLOBALS['SIM_EXEC_TIME'].') ';
+		$this->where_hid_del.= 'AND (pages.starttime<='.$GLOBALS['SIM_ACCESS_TIME'].') AND (pages.endtime=0 OR pages.endtime>'.$GLOBALS['SIM_ACCESS_TIME'].') ';
 
 			// Filter out new/deleted place-holder pages in case we are NOT in a versioning preview (that means we are online!)
 		if (!$this->versioningPreview)	{
@@ -1019,11 +1019,11 @@
 					}
 					if ($ctrl['enablecolumns']['starttime'] && !$ignore_array['starttime']) {
 						$field = $table.'.'.$ctrl['enablecolumns']['starttime'];
-						$query.=' AND ('.$field.'<='.$GLOBALS['SIM_EXEC_TIME'].')';
+						$query.=' AND ('.$field.'<='.$GLOBALS['SIM_ACCESS_TIME'].')';
 					}
 					if ($ctrl['enablecolumns']['endtime'] && !$ignore_array['endtime']) {
 						$field = $table.'.'.$ctrl['enablecolumns']['endtime'];
-						$query.=' AND ('.$field.'=0 OR '.$field.'>'.$GLOBALS['SIM_EXEC_TIME'].')';
+						$query.=' AND ('.$field.'=0 OR '.$field.'>'.$GLOBALS['SIM_ACCESS_TIME'].')';
 					}
 					if ($ctrl['enablecolumns']['fe_group'] && !$ignore_array['fe_group']) {
 						$field = $table.'.'.$ctrl['enablecolumns']['fe_group'];
Index: t3lib/class.t3lib_tstemplate.php
===================================================================
--- t3lib/class.t3lib_tstemplate.php	(revision 3009)
+++ t3lib/class.t3lib_tstemplate.php	(working copy)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2007 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -212,15 +212,15 @@
 	 */
 	function init()	{
 			// $this->whereClause is used only to select templates from sys_template.
-			// $GLOBALS['SIM_EXEC_TIME'] is used so that we're able to simulate a later time as a test...
+			// $GLOBALS['SIM_ACCESS_TIME'] is used so that we're able to simulate a later time as a test...
 		$this->whereClause='AND deleted=0 ';
 		if (!$GLOBALS['TSFE']->showHiddenRecords)	{
 			$this->whereClause.='AND hidden=0 ';
 		}
-		if ($GLOBALS['TSFE']->showHiddenRecords || $GLOBALS['SIM_EXEC_TIME']!=$GLOBALS['EXEC_TIME'])	{	// Set the simulation flag, if simulation is detected!
+		if ($GLOBALS['TSFE']->showHiddenRecords || $GLOBALS['SIM_ACCESS_TIME']!=$GLOBALS['ACCESS_TIME'])	{	// Set the simulation flag, if simulation is detected!
 			$this->simulationHiddenOrTime=1;
 		}
-		$this->whereClause.= 'AND (starttime<='.$GLOBALS['SIM_EXEC_TIME'].') AND (endtime=0 OR endtime>'.$GLOBALS['SIM_EXEC_TIME'].')';
+		$this->whereClause.= 'AND (starttime<='.$GLOBALS['SIM_ACCESS_TIME'].') AND (endtime=0 OR endtime>'.$GLOBALS['SIM_ACCESS_TIME'].')';
 		if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib'])	{
 			$this->menuclasses='tmenu,jsmenu,gmenu';
 		}
Index: typo3/sysext/cms/tslib/class.tslib_menu.php
===================================================================
--- typo3/sysext/cms/tslib/class.tslib_menu.php	(revision 3009)
+++ typo3/sysext/cms/tslib/class.tslib_menu.php	(working copy)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2007 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -550,7 +550,7 @@
 							$extraWhere.= ' AND pages.no_search=0';
 						}
 						if ($maxAge>0)	{
-							$extraWhere.=' AND '.$sortField.'>'.($GLOBALS['SIM_EXEC_TIME']-$maxAge);
+							$extraWhere.=' AND '.$sortField.'>'.($GLOBALS['SIM_ACCESS_TIME']-$maxAge);
 						}
 
 						$res = $GLOBALS['TSFE']->cObj->exec_getQuery('pages',Array('pidInList'=>'0', 'uidInList'=>$id_list, 'where'=>$sortField.'>=0'.$extraWhere, 'orderBy'=>($altSortFieldValue ? $altSortFieldValue : $sortField.' desc'),'max'=>$limit));
Index: typo3/sysext/cms/tslib/class.tslib_fe.php
===================================================================
--- typo3/sysext/cms/tslib/class.tslib_fe.php	(revision 3011)
+++ typo3/sysext/cms/tslib/class.tslib_fe.php	(working copy)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2007 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -706,6 +706,7 @@
 		$this->showHiddenPage = 0;
 		$this->showHiddenRecords = 0;
 		$GLOBALS['SIM_EXEC_TIME'] = $GLOBALS['EXEC_TIME'];
+		$GLOBALS['SIM_ACCESS_TIME'] = $GLOBALS['ACCESS_TIME'];
 		$this->fePreview = 0;
 	}
 
@@ -736,7 +737,10 @@
 					$this->showHiddenRecords = $GLOBALS['BE_USER']->extGetFeAdminValue('preview','showHiddenRecords');
 						// simulate date
 					$simTime = $GLOBALS['BE_USER']->extGetFeAdminValue('preview','simulateDate');
-					if ($simTime)	$GLOBALS['SIM_EXEC_TIME']=$simTime;
+					if ($simTime)	{
+						$GLOBALS['SIM_EXEC_TIME'] = $simTime;
+						$GLOBALS['SIM_ACCESS_TIME'] = $simTime - ($simTime % 60);;
+					}
 						// simulate user
 					$simUserGroup = $GLOBALS['BE_USER']->extGetFeAdminValue('preview','simulateUserGroup');
 					$this->simUserGroup = $simUserGroup;
@@ -1126,7 +1130,7 @@
 	/**
 	 * Checks page record for enableFields
 	 * Returns true if enableFields does not disable the page record.
-	 * Takes notice of the ->showHiddenPage flag and uses SIM_EXEC_TIME for start/endtime evaluation
+	 * Takes notice of the ->showHiddenPage flag and uses SIM_ACCESS_TIME for start/endtime evaluation
 	 *
 	 * @param	array		The page record to evaluate (needs fields: hidden, starttime, endtime, fe_group)
 	 * @param	boolean		Bypass group-check
@@ -1135,8 +1139,8 @@
 	 */
 	function checkEnableFields($row,$bypassGroupCheck=FALSE)	{
 		if ((!$row['hidden'] || $this->showHiddenPage)
-			&& $row['starttime']<=$GLOBALS['SIM_EXEC_TIME']
-			&& ($row['endtime']==0 || $row['endtime']>$GLOBALS['SIM_EXEC_TIME'])
+			&& $row['starttime']<=$GLOBALS['SIM_ACCESS_TIME']
+			&& ($row['endtime']==0 || $row['endtime']>$GLOBALS['SIM_ACCESS_TIME'])
 			&& ($bypassGroupCheck || $this->checkPageGroupAccess($row))
 		) { return TRUE; }
 	}
@@ -1216,8 +1220,8 @@
 				// If $k>0 it is parent pages being tested. They are only significant for the access to the first page IF they had the extendToSubpages flag set, hence checked only then!
 				if (!$k || $pagerec['extendToSubpages'])	{
 					if ($pagerec['hidden'])	$output['hidden'][$pagerec['uid']] = TRUE;
-					if ($pagerec['starttime'] > $GLOBALS['SIM_EXEC_TIME'])	$output['starttime'][$pagerec['uid']] = $pagerec['starttime'];
-					if ($pagerec['endtime']!=0 && $pagerec['endtime'] <= $GLOBALS['SIM_EXEC_TIME'])	$output['endtime'][$pagerec['uid']] = $pagerec['endtime'];
+					if ($pagerec['starttime'] > $GLOBALS['SIM_ACCESS_TIME'])	$output['starttime'][$pagerec['uid']] = $pagerec['starttime'];
+					if ($pagerec['endtime']!=0 && $pagerec['endtime'] <= $GLOBALS['SIM_ACCESS_TIME'])	$output['endtime'][$pagerec['uid']] = $pagerec['endtime'];
 					if (!$this->checkPageGroupAccess($pagerec))	$output['fe_group'][$pagerec['uid']] = $pagerec['fe_group'];
 				}
 			}
