I've debugged the core.
Just a little information for myself:
The var $GLOBALS['SIM_ACCESS_TIME'] is first set in class TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::initializeGlobalTimeTrackingVariables():
protected static function initializeGlobalTimeTrackingVariables()
{
// Set PARSETIME_START to the system time in milliseconds.
$GLOBALS['PARSETIME_START'] = GeneralUtility::milliseconds();
// Microtime of (nearly) script start
$GLOBALS['TYPO3_MISC']['microtime_start'] = microtime(true);
// EXEC_TIME is set so that the rest of the script has a common value for the script execution time
$GLOBALS['EXEC_TIME'] = time();
// $ACCESS_TIME is a common time in minutes for access control
$GLOBALS['ACCESS_TIME'] = $GLOBALS['EXEC_TIME'] - $GLOBALS['EXEC_TIME'] % 60;
// $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
$GLOBALS['SIM_EXEC_TIME'] = $GLOBALS['EXEC_TIME'];
// If $SIM_EXEC_TIME is changed this value must be set accordingly
$GLOBALS['SIM_ACCESS_TIME'] = $GLOBALS['ACCESS_TIME'];
}
After that the class \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController overrides the var in the method clear_preview():
public function clear_preview()
{
$this->showHiddenPage = false;
$this->showHiddenRecords = false;
$GLOBALS['SIM_EXEC_TIME'] = $GLOBALS['EXEC_TIME'];
$GLOBALS['SIM_ACCESS_TIME'] = $GLOBALS['ACCESS_TIME'];
$this->fePreview = 0;
}
In the method clear_preview() the vars $GLOBALS['EXEC_TIME'] and $GLOBALS['ACCESS_TIME'] are correct.
After that, in method TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->determineId() the time is overriden in here:
public function determineId() {
//...
$simTime = $backendUser->adminPanel->extGetFeAdminValue('preview', 'simulateDate');
if ($simTime) {
$GLOBALS['SIM_EXEC_TIME'] = $simTime;
$GLOBALS['SIM_ACCESS_TIME'] = $simTime - $simTime % 60;
}
//...
}
The accessTimeStamp is now set to 0 in \TYPO3\CMS\Core\Database\Query\Restriction\EndTimeRestriction and the SIM_EXEC_TIME is "14:59 1-2-2017".
The problem:
After the $GLOBALS['EXEC_TIME'] and $GLOBALS['ACCESS_TIME'] has been set, the SIM_EXEC_TIME is "14:59 1-2-2017" in the class EndTimeRestriction. But it must be an timestamp (f.e. 1496145720)!