@VisibleForTesting
    static long getInitialDelayTime(long periodSeconds, LocalDateTime startTime, LocalDateTime scheduleTime) {
        Duration duration = Duration.between(scheduleTime, startTime);
        long initialDelay = duration.getSeconds();
        // if startTime < now, start scheduling from the next period
        if (initialDelay < 0) {
            // if schedule time is not a complete second, add extra 1 second to avoid less than expect scheduler time.
            // eg:
            //  Register scheduler, task:mv-271809, initialDay:22, periodSeconds:60, startTime:2023-12-29T17:50,
            //  scheduleTime:2024-01-30T15:27:37.342356010
            // Before:schedule at : Hour:MINUTE:59
            // After: schedule at : HOUR:MINUTE:00
            int extra = scheduleTime.getNano() > 0 ? 1 : 0;
            return ((initialDelay % periodSeconds) + periodSeconds + extra) % periodSeconds;
        } else {
            return initialDelay;
        }
    }
@Test
    public void testGetInitialDelayTime2() throws Exception {
        Assert.assertEquals(23, TaskManager.getInitialDelayTime(60, parseLocalDateTime("2023-12-29 19:50:00"),
                LocalDateTime.parse("2024-01-30T15:27:37.342356010")));
        Assert.assertEquals(50, TaskManager.getInitialDelayTime(60, parseLocalDateTime("2023-12-29 19:50:00"),
                LocalDateTime.parse("2024-01-30T15:27:10.342356010")));
    }