use Date.now() instead of new Date().getTime()
For more idiomatic JavaScript.
This commit is contained in:
parent
2805ca2647
commit
eb1d1a5f0e
4
index.js
4
index.js
@ -119,7 +119,7 @@ var totp = {};
|
||||
totp.gen = function(key, opt) {
|
||||
opt = opt || {};
|
||||
var time = opt.time || 30;
|
||||
var _t = new Date().getTime();
|
||||
var _t = Date.now();
|
||||
|
||||
// Time has been overwritten.
|
||||
if(opt._t) {
|
||||
@ -170,7 +170,7 @@ totp.gen = function(key, opt) {
|
||||
totp.verify = function(token, key, opt) {
|
||||
opt = opt || {};
|
||||
var time = opt.time || 30;
|
||||
var _t = new Date().getTime();
|
||||
var _t = Date.now();
|
||||
|
||||
// Time has been overwritten.
|
||||
if(opt._t) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user