public static Tuple getCronNextTrigger()

in services/library/src/main/java/com/google/cloud/pso/bq_snapshot_manager/functions/f02_configurator/Configurator.java [401:427]


    public static Tuple<Boolean, LocalDateTime> getCronNextTrigger(String cronExpression,
                                                                   Timestamp lastBackupAtTs,
                                                                   Timestamp referencePoint
    ) {

        CronExpression cron = CronExpression.parse(cronExpression);

        LocalDateTime nowDt = LocalDateTime.ofEpochSecond(
                referencePoint.getSeconds(),
                0,
                ZoneOffset.UTC
        );

        LocalDateTime lastBackupAtDt = LocalDateTime.ofEpochSecond(
                lastBackupAtTs.getSeconds(),
                0,
                ZoneOffset.UTC
        );

        // get next execution date based on the last backup date
        LocalDateTime nextExecutionDt = cron.next(lastBackupAtDt);

        return Tuple.of(
                nextExecutionDt.isBefore(nowDt),
                nextExecutionDt
        );
    }