Project: titanium
Issue TIMOB-18855: Windows: Time between creating Date() objects runs a factor 1000 slower then reality
The following code demonstrates that when you create a {{new Date()}} object in a {{setTimeout}} or {{setInterval}} method the time is off by a factor 1000. If you run https://github.com/appcelerator-developer-relations/Mobile-App-Performance/ you will see that this also occurs when you have a expensive computation that takes several seconds and you log the time before and after. {code} var run = require('run'); var win = Ti.UI.createWindow({	backgroundColor: 'white',	layout: 'vertical' }); var btnTimeout = Ti.UI.createButton({	top: 20,	height: 40,	color: '#FFF',	backgroundColor: '#000',	title: 'setTimeout' }); btnTimeout.addEventListener('click', function () {	addLabel();	setTimeout(function () {	addLabel();	setTimeout(function () {	addLabel();	win.add(btnInterval);	}, 5000);	}, 0); }); win.add(btnTimeout); var btnInterval = Ti.UI.createButton({	top: 20,	height: 40,	color: '#FFF',	backgroundColor: '#000',	title: 'setInterval' }); btnInterval.addEventListener('click', function () {	var interval;	var intervals = 0;	addLabel();	interval = setInterval(function () {	intervals++;	addLabel();	if (intervals === 2) {	clearInterval(interval);	}	}, 5000); }); function addLabel() {	var d = new Date();	win.add(Ti.UI.createLabel({	top: 20,	width: Ti.UI.FILL,	height: 40,	text: pad(d.getHours()) + ':' + pad(d.getMinutes()) + ':' + pad(d.getSeconds()) + ':' + pad(d.getMilliseconds()),	color: '#000'	})); } function pad(int) {	var str = int.toString();	if (str.length === 1) {	str = '0' + str;	}	return str; } win.open(); {code} I did the tests on the Emulator, but looking at the results [~kota] achieved with https://github.com/appcelerator-developer-relations/Mobile-App-Performance/ the same is true for device.
Story points: 8