您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334
  1. import { time } from "console";
  2. export class Calulator {
  3. // timestamp format input
  4. CTPS(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. CQPS(count: number, start: number, end: number): number {
  17. // Calculate the time difference in milliseconds
  18. const timeDifference = (end - start) / 1000;
  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. console.log(`time diff = ${timeDifference}`);
  24. // Calculate CEPS
  25. const CEPS = count / timeDifference;
  26. return CEPS;
  27. }
  28. }