Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { time } from "console";
  2. export class Calulator {
  3. // timestamp format input
  4. CTPS_NUM(count: number, start: number, end: number): number {
  5. // Calculate the time difference in milliseconds
  6. const timeDifference = (end - start) / 1000;
  7. // Ensure timeDifference is not zero to avoid division by zero
  8. if (timeDifference === 0) {
  9. throw new Error("Time difference cannot be zero.");
  10. }
  11. console.log(`time diff = ${timeDifference}`);
  12. // Calculate CTPS
  13. const CEPS = count / timeDifference;
  14. return CEPS;
  15. }
  16. CTPS(count: number, start: Date, end: Date): number {
  17. // Calculate the time difference in milliseconds
  18. const timeDifference = end.getTime() - start.getTime();
  19. // Ensure timeDifference is not zero to avoid division by zero
  20. if (timeDifference === 0) {
  21. throw new Error("Time difference cannot be zero.");
  22. }
  23. // Calculate CTPS
  24. const CEPS = count / timeDifference;
  25. return CEPS;
  26. }
  27. CEPS(count: number, start: Date, end: Date): number {
  28. // Calculate the time difference in milliseconds
  29. const timeDifference = end.getTime() - start.getTime();
  30. // Ensure timeDifference is not zero to avoid division by zero
  31. if (timeDifference === 0) {
  32. throw new Error("Time difference cannot be zero.");
  33. }
  34. // Calculate CEPS
  35. const CEPS = count / timeDifference;
  36. return CEPS;
  37. }
  38. }