| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- import { time } from "console";
-
-
-
- export class Calulator {
-
- // timestamp format input
- CTPS_NUM(count: number, start: number, end: number): number {
- // Calculate the time difference in milliseconds
- const timeDifference = (end - start) / 1000;
- // Ensure timeDifference is not zero to avoid division by zero
- if (timeDifference === 0) {
- throw new Error("Time difference cannot be zero.");
- }
-
- console.log(`time diff = ${timeDifference}`);
-
-
- // Calculate CTPS
- const CEPS = count / timeDifference;
- return CEPS;
- }
-
- CTPS(count: number, start: Date, end: Date): number {
- // Calculate the time difference in milliseconds
- const timeDifference = end.getTime() - start.getTime();
- // Ensure timeDifference is not zero to avoid division by zero
- if (timeDifference === 0) {
- throw new Error("Time difference cannot be zero.");
- }
- // Calculate CTPS
- const CEPS = count / timeDifference;
- return CEPS;
- }
-
- CEPS(count: number, start: Date, end: Date): number {
- // Calculate the time difference in milliseconds
- const timeDifference = end.getTime() - start.getTime();
-
- // Ensure timeDifference is not zero to avoid division by zero
- if (timeDifference === 0) {
- throw new Error("Time difference cannot be zero.");
- }
-
- // Calculate CEPS
- const CEPS = count / timeDifference;
- return CEPS;
- }
- }
|