// Define the function to calculate average CTPS function calculateAverageCTPS(N, start, end) { // Convert the times to Date objects, if they are not already const startTime = new Date(start); const endTime = new Date(end); // Calculate the time difference in seconds const timeDifferenceInSeconds = (endTime.getTime() - startTime.getTime()) / 1000; // Calculate the average CTPS const averageCTPS = N / timeDifferenceInSeconds; return averageCTPS; } // Example usage const count = 1000; // Example number of transactions const start = "2023-11-15T08:00:00Z"; // Start time of the first transaction const end = "2023-11-15T08:05:00Z"; // Finish time of the latest transaction // const tSend_TX1 = new Date('2024-11-15T12:00:00Z'); // Replace with actual end time // const tFin_latest_TXk = new Date('2024-11-15T11:00:00Z'); // Replace with actual send time const result = calculateAverageCTPS(count, start, end); console.log("Average CTPS:", result);