package com.lanyuanxiaoyao.service.executor.task;

import com.lanyuanxiaoyao.service.executor.task.helper.TimeRangeHelper;
import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
import java.util.concurrent.TimeUnit;

/**
 * @author lanyuanxiaoyao
 */
public class TimeRangeTest {
    private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")
            .withLocale(Locale.CHINA)
            .withZone(ZoneId.systemDefault());
    public static void main(String[] args) {
        TimeRangeHelper.range(1716912000000L, Instant.now().toEpochMilli(), TimeUnit.MINUTES.toMillis(30))
                .forEach(range -> System.out.printf("%s - %s\n", FORMATTER.format(Instant.ofEpochMilli(range.getStart())), FORMATTER.format(Instant.ofEpochMilli(range.getEnd()))));
    }
}
