Bug 877607 - Tests. r=gene.lian

This commit is contained in:
Albert Crespell 2013-06-08 09:57:02 +02:00
parent 8c0e7fa661
commit 86fdfbd03b

View File

@ -51,8 +51,9 @@ function test() {
}
function checkDataDates(data, start, end, sampleRate){
start = Math.floor(start.getTime() / sampleRate) * sampleRate;
end = Math.floor(end.getTime() / sampleRate) * sampleRate;
var offset = (new Date()).getTimezoneOffset() * 60 * 1000;
start = Math.floor((start.getTime() - offset) / sampleRate) * sampleRate + offset;
end = Math.floor((end.getTime() - offset) / sampleRate) * sampleRate + offset;
var counter = 0;
var date = start;
@ -149,7 +150,9 @@ var steps = [
// Get samplerate in millis
var sampleRate = netStats.sampleRate * 1000;
// Get date with samplerate's precision
var endDate = new Date(Math.floor(new Date().getTime() / sampleRate) * sampleRate);
var offset = new Date().getTimezoneOffset() * 60 * 1000;
var endDate = new Date(Math.floor((new Date().getTime() - offset) / sampleRate)
* sampleRate + offset);
var startDate = new Date(endDate.getTime() - (sampleRate * diff));
// Calculate the number of samples that should be returned based on the
// the samplerate and including final and initial samples.
@ -179,7 +182,9 @@ var steps = [
// Get samplerate in millis
var sampleRate = netStats.sampleRate * 1000;
// Get date with samplerate's precision
var endDate = new Date(Math.floor(new Date().getTime() / sampleRate) * sampleRate);
var offset = new Date().getTimezoneOffset() * 60 * 1000;
var endDate = new Date(Math.floor((new Date().getTime() - offset) / sampleRate)
* sampleRate + offset);
var startDate = new Date(endDate.getTime() - (sampleRate * diff));
// Calculate the number of samples that should be returned based on the
// the samplerate and including final and initial samples.