use Date.now() to get current time

This commit is contained in:
KDSBrowne 2019-11-13 22:11:46 +00:00
parent 3e23631389
commit a3ee4e7e59

View File

@ -31,7 +31,7 @@ export default function updateVoiceUser(meetingId, voiceUser) {
if (voiceUser.talking) { if (voiceUser.talking) {
modifier.$set.spoke = true; modifier.$set.spoke = true;
modifier.$set.startTime = new Date().getTime(); modifier.$set.startTime = Date.now();
modifier.$set.endTime = null; modifier.$set.endTime = null;
} }
@ -54,14 +54,14 @@ export default function updateVoiceUser(meetingId, voiceUser) {
if (user) { if (user) {
const { endTime, talking } = user; const { endTime, talking } = user;
const spokeDelay = ((new Date().getTime() - endTime) < TALKING_TIMEOUT); const spokeDelay = ((Date.now() - endTime) < TALKING_TIMEOUT);
if (talking || spokeDelay) return; if (talking || spokeDelay) return;
modifier.$set.spoke = false; modifier.$set.spoke = false;
VoiceUsers.update(selector, modifier, cb); VoiceUsers.update(selector, modifier, cb);
} }
}, TALKING_TIMEOUT); }, TALKING_TIMEOUT);
modifier.$set.endTime = new Date().getTime(); modifier.$set.endTime = Date.now();
} }
return VoiceUsers.update(selector, modifier, cb); return VoiceUsers.update(selector, modifier, cb);