function updateOnlineDurations() {
    document.querySelectorAll('.visitor').forEach(visitorDiv => {
        if (visitorDiv.querySelector('.online')) {
            const durationElem = visitorDiv.querySelector('.duration');
            const currentText = durationElem.textContent;
            const [hours, minutes, seconds] = currentText.split(':').map(Number);
            const totalSeconds = hours * 3600 + minutes * 60 + seconds;

            // Increment the duration by 1 second
            const updatedTotalSeconds = totalSeconds + 1;
            const updatedHours = Math.floor(updatedTotalSeconds / 3600);
            const updatedMinutes = Math.floor((updatedTotalSeconds % 3600) / 60);
            const updatedSeconds = updatedTotalSeconds % 60;

            // Format the updated duration
            const formattedDuration = 
                (updatedHours > 0 ? `${String(updatedHours).padStart(2, '0') + ':' : ''}` +
                `${String(updatedMinutes).padStart(2, '0')}:${String(updatedSeconds).padStart(2, '0')}`);

            // Update the duration element
            durationElem.textContent = formattedDuration;
        }
    });
}

// Call this function at intervals to update durations
setInterval(updateOnlineDurations, 1000); // Update every second
