Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. var secs = 10760;
  2. var hora = document.getElementById('cronometro')
  3. var chamadas = document.getElementById('chamadas')
  4. var segundos = document.getElementById('segundos')
  5. var tma = document.getElementById('tma')
  6. var desvio = document.getElementById('desvio')
  7. setInterval(cronometro, 1000);
  8.  
  9.  
  10. function cronometro() {
  11. secs++;
  12. hora.innerHTML = [
  13. secs / 60 / 60, // horas
  14. (secs / 60) % 60, // minutos
  15. secs % 60 // segundos
  16. ].map(Math.floor).map(
  17. s => (s < 10) ? '0' + s : s
  18. ).join(':');
  19. segundos.innerHTML = secs;
  20. var tmaVal = secs / parseInt(chamadas.value, 10);
  21. tma.innerHTML = tmaVal;
  22. desvio.innerHTML = (((tmaVal / Math.floor(tmaVal - 1)) - 1) * 100).toFixed(2);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement