31 lines
953 B
C#
31 lines
953 B
C#
using ServerCore; using ServerBase;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
|
namespace ServerBase;
|
|
|
|
public class TimeEventForMinuteTicker : EntityTicker
|
|
{
|
|
public TimeEventForMinuteTicker(double onTickIntervalMilliseconds, CancellationTokenSource? cts)
|
|
: base(EntityType.TimeEventTicker, onTickIntervalMilliseconds, cts)
|
|
{
|
|
}
|
|
|
|
public override async Task onTaskTick()
|
|
{
|
|
var date = DateTimeHelper.Current;
|
|
|
|
// 1. 00 Second 체크 Delay
|
|
if (date.Second != 0)
|
|
{
|
|
var check = ConstValue.default_1_min_to_sec * ConstValue.default_1_sec_to_milisec;
|
|
var current = date.Second * ConstValue.default_1_sec_to_milisec + date.Millisecond;
|
|
await Task.Delay(check - current);
|
|
}
|
|
|
|
// 2. task 실행 ( fire and forget )
|
|
_ = Task.Run(() => DailyTimeEventManager.Instance.runTimeEvents());
|
|
|
|
await Task.CompletedTask;
|
|
}
|
|
} |