Skip to content

Commit 4480476

Browse files
committed
1.75
1 parent e89bd33 commit 4480476

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package dev.felnull.fnjl;
22

33
public class FNJLBuildIn {
4-
protected static final String VERSION = "1.74";
4+
protected static final String VERSION = "1.75";
55
}

common/src/main/java/dev/felnull/fnjl/util/FNRuntimeUtil.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,29 @@ public class FNRuntimeUtil {
2323
* @param runnable 実行
2424
*/
2525
public static void loopDayRunner(@NotNull Timer timer, @NotNull Executor executor, @Range(from = 0, to = 23) int hours, @Range(from = 0, to = 59) int minutes, @NotNull Runnable runnable) {
26+
loopDayRunner(timer, executor, hours, minutes, 0, runnable);
27+
}
28+
29+
/**
30+
* 1日ごとに決まった時間に実行
31+
*
32+
* @param timer タイマー
33+
* @param executor エクスキューター
34+
* @param hours 時
35+
* @param minutes 分
36+
* @param second 秒
37+
* @param runnable 実行
38+
*/
39+
public static void loopDayRunner(@NotNull Timer timer, @NotNull Executor executor, @Range(from = 0, to = 23) int hours, @Range(from = 0, to = 59) int minutes, @Range(from = 0, to = 59) int second, @NotNull Runnable runnable) {
2640
Calendar calendar = Calendar.getInstance();
2741
calendar.setTime(new Date());
2842

29-
if (calendar.get(Calendar.HOUR_OF_DAY) > hours || (calendar.get(Calendar.HOUR_OF_DAY) == hours && calendar.get(Calendar.MINUTE) >= minutes))
43+
if (calendar.get(Calendar.HOUR_OF_DAY) > hours || (calendar.get(Calendar.HOUR_OF_DAY) == hours && calendar.get(Calendar.MINUTE) > minutes) || (calendar.get(Calendar.HOUR_OF_DAY) == hours && calendar.get(Calendar.MINUTE) == minutes && calendar.get(Calendar.SECOND) >= second))
3044
calendar.add(Calendar.DATE, 1);
3145

3246
calendar.set(Calendar.HOUR_OF_DAY, hours);
3347
calendar.set(Calendar.MINUTE, minutes);
48+
calendar.set(Calendar.SECOND, second);
3449

3550
loopDayRunner_(calendar, timer, executor, runnable);
3651
}

common/src/test/java/dev/felnull/fnjltest/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class Main {
1111
public static void main(String[] args) throws Exception {
1212
ExecutorService executorService = Executors.newCachedThreadPool();
1313

14-
FNRuntimeUtil.loopDayRunner(new Timer(), executorService, 16, 54, () -> {
14+
FNRuntimeUtil.loopDayRunner(new Timer(), executorService, 19, 38, 20, () -> {
1515
System.out.println("ウァァ!!オレモイッチャウゥゥゥ!!!ウウウウウウウウウゥゥゥゥゥゥゥゥウウウウウウウウ!イィィイィィィイイイィイイイイ: " + new Date());
1616
});
1717

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
fnjl_group=dev.felnull
22
fnjl_name=felnull-java-library
3-
fnjl_version=1.74
3+
fnjl_version=1.75
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package dev.felnull.fnjln;
22

33
public class FNJLNBuildIn {
4-
protected static final String VERSION = "1.74";
4+
protected static final String VERSION = "1.75";
55

66
protected static final int NATIVE_LIBRARY_VERSION = 1;
77
}

0 commit comments

Comments
 (0)