Skip to content
This repository has been archived by the owner on Jun 7, 2019. It is now read-only.

Commit

Permalink
Use offsets in direction of time
Browse files Browse the repository at this point in the history
  • Loading branch information
willclarktech committed Jul 25, 2017
1 parent f6451ac commit cec6c17
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion lib/time/slots.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function getTime (time) {
function getTimeWithOffset (offset) {
var now = new Date().getTime();
var time = offset
? now - (offset * 1000)
? now + (offset * 1000)
: now;
return getTime(time);
}
Expand Down
2 changes: 1 addition & 1 deletion test/time/slots.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('slots.js', function () {
});

it('should call getTime using the offset', function () {
var offset = 3;
var offset = -3;

var time = getTimeWithOffset(offset);

Expand Down
4 changes: 2 additions & 2 deletions test/transactions/dapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ describe('dapp.js', function () {
});

it('should use time slots with an offset to get the time for the timestamp', function () {
var offset = 10;
var offset = -10;
trs = createDapp('secret', null, options, offset);

(trs).should.have.property('timestamp').and.be.equal(slots.getTime() - offset);
(trs).should.have.property('timestamp').and.be.equal(slots.getTime() + offset);
});
});

Expand Down
4 changes: 2 additions & 2 deletions test/transactions/delegate.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ describe('delegate.js', function () {
});

it('should use time slots with an offset to get the time for the timestamp', function () {
var offset = 10;
var offset = -10;

trs = createDelegate('secret', 'delegate', null, offset);

(trs).should.have.property('timestamp').and.be.equal(slots.getTime() - offset);
(trs).should.have.property('timestamp').and.be.equal(slots.getTime() + offset);
});

});
Expand Down
8 changes: 4 additions & 4 deletions test/transactions/multisignature.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ describe('multisignature.js', function () {
});

it('should use time slots with an offset to get the time for the timestamp', function () {
var offset = 10;
var offset = -10;

var trs = multisignature.createMultisignature('secret', '', multiSignaturePublicKeyArray, requestLifeTime, minimumSignatures, offset);

(trs).should.have.property('timestamp').and.be.equal(slots.getTime() - offset);
(trs).should.have.property('timestamp').and.be.equal(slots.getTime() + offset);
});

});
Expand Down Expand Up @@ -196,11 +196,11 @@ describe('multisignature.js', function () {
});

it('should use time slots with an offset to get the time for the timestamp', function () {
var offset = 10;
var offset = -10;

var trs = multisignature.createTransaction(recipientId, amount, secret, null, null, offset);

(trs).should.have.property('timestamp').and.be.equal(slots.getTime() - offset);
(trs).should.have.property('timestamp').and.be.equal(slots.getTime() + offset);
});

});
Expand Down
4 changes: 2 additions & 2 deletions test/transactions/signature.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ describe('signature.js', function () {
});

it('should use time slots with an offset to get the time for the timestamp', function () {
var offset = 10;
var offset = -10;

sgn = createSignature('secret', 'second secret', offset);

(sgn).should.have.property('timestamp').and.be.equal(slots.getTime() - offset);
(sgn).should.have.property('timestamp').and.be.equal(slots.getTime() + offset);
});

});
Expand Down
4 changes: 2 additions & 2 deletions test/transactions/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ describe('transaction.js', function () {
});

it('should use time slots with an offset to get the time for the timestamp', function () {
var offset = 10;
var offset = -10;

trs = createTransaction('58191285901858109L', 1000, 'secret', null, null, offset);

(trs).should.have.property('timestamp').and.be.equal(slots.getTime() - offset);
(trs).should.have.property('timestamp').and.be.equal(slots.getTime() + offset);
});

});
Expand Down
8 changes: 4 additions & 4 deletions test/transactions/transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ describe('transfer.js', function () {
});

it('should use time slots with an offset to get the time for the timestamp', function () {
var offset = 10;
var offset = -10;
var trs = createInTransfer(dappId, amount, secret, null, offset);

(trs).should.have.property('timestamp').and.be.equal(slots.getTime() - offset);
(trs).should.have.property('timestamp').and.be.equal(slots.getTime() + offset);
});

});
Expand Down Expand Up @@ -193,10 +193,10 @@ describe('transfer.js', function () {
});

it('should use time slots with an offset to get the time for the timestamp', function () {
var offset = 10;
var offset = -10;
var trs = createOutTransfer(dappId, transactionId, recipientId, amount, secret, null, offset);

(trs).should.have.property('timestamp').and.be.equal(slots.getTime() - offset);
(trs).should.have.property('timestamp').and.be.equal(slots.getTime() + offset);
});

});
Expand Down
4 changes: 2 additions & 2 deletions test/transactions/vote.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ describe('vote.js', function () {
});

it('should use time slots with an offset to get the time for the timestamp', function () {
var offset = 10;
var offset = -10;
vt = createVote('secret', publicKeys, null, offset);

(vt).should.have.property('timestamp').and.be.equal(slots.getTime() - offset);
(vt).should.have.property('timestamp').and.be.equal(slots.getTime() + offset);
});

});
Expand Down

0 comments on commit cec6c17

Please sign in to comment.