|
@ -26,7 +26,6 @@ |
|
|
, check_hwm/1 |
|
|
, check_hwm/1 |
|
|
, check_hwm/2 |
|
|
, check_hwm/2 |
|
|
, makeInnerSinkName/1 |
|
|
, makeInnerSinkName/1 |
|
|
, otp_version/0 |
|
|
|
|
|
, maybe_flush/2 |
|
|
, maybe_flush/2 |
|
|
, isFileChanged/3 |
|
|
, isFileChanged/3 |
|
|
, get_env/2 |
|
|
, get_env/2 |
|
@ -264,86 +263,123 @@ parseRotateDateSpec(_) -> |
|
|
{error, invalid_date_spec}. |
|
|
{error, invalid_date_spec}. |
|
|
|
|
|
|
|
|
calcNextRotate(Spec) -> |
|
|
calcNextRotate(Spec) -> |
|
|
NowDataTime = erlang:localtime(), |
|
|
|
|
|
Later = calculate_next_rotation(Spec, NowDataTime), |
|
|
|
|
|
calendar:datetime_to_gregorian_seconds(Later) - calendar:datetime_to_gregorian_seconds(NowDataTime). |
|
|
|
|
|
|
|
|
|
|
|
calculate_next_rotation([], Now) -> |
|
|
|
|
|
Now; |
|
|
|
|
|
calculate_next_rotation([{minute, X} | T], {{_, _, _}, {Hour, Minute, _}} = Now) when Minute < X -> |
|
|
|
|
|
%% rotation is this hour |
|
|
|
|
|
NewNow = setelement(2, Now, {Hour, X, 0}), |
|
|
|
|
|
calculate_next_rotation(T, NewNow); |
|
|
|
|
|
calculate_next_rotation([{minute, X} | T], Now) -> |
|
|
|
|
|
%% rotation is next hour |
|
|
|
|
|
Seconds = calendar:datetime_to_gregorian_seconds(Now) + 3600, |
|
|
|
|
|
DateTime = calendar:gregorian_seconds_to_datetime(Seconds), |
|
|
|
|
|
{_, {NewHour, _, _}} = DateTime, |
|
|
|
|
|
NewNow = setelement(2, DateTime, {NewHour, X, 0}), |
|
|
|
|
|
calculate_next_rotation(T, NewNow); |
|
|
|
|
|
calculate_next_rotation([{hour, X} | T], {{_, _, _}, {Hour, _, _}} = Now) when Hour < X -> |
|
|
|
|
|
%% rotation is today, sometime |
|
|
|
|
|
NewNow = setelement(2, Now, {X, 0, 0}), |
|
|
|
|
|
calculate_next_rotation(T, NewNow); |
|
|
|
|
|
calculate_next_rotation([{hour, X} | T], {{_, _, _}, _} = Now) -> |
|
|
|
|
|
%% rotation is not today |
|
|
|
|
|
Seconds = calendar:datetime_to_gregorian_seconds(Now) + 86400, |
|
|
|
|
|
DateTime = calendar:gregorian_seconds_to_datetime(Seconds), |
|
|
|
|
|
NewNow = setelement(2, DateTime, {X, 0, 0}), |
|
|
|
|
|
calculate_next_rotation(T, NewNow); |
|
|
|
|
|
calculate_next_rotation([{day, Day} | T], {Date, _Time} = Now) -> |
|
|
|
|
|
DoW = calendar:day_of_the_week(Date), |
|
|
|
|
|
AdjustedDay = case Day of |
|
|
|
|
|
|
|
|
{Date, Time} = NowDataTime = erlang:localtime(), |
|
|
|
|
|
calcNextRotate(Spec, Date, Time, NowDataTime). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
calcNextRotate([], Data, Time, NowDataTime) -> |
|
|
|
|
|
Later = {Data, Time}, |
|
|
|
|
|
calendar:datetime_to_gregorian_seconds(Later) - calendar:datetime_to_gregorian_seconds(NowDataTime); |
|
|
|
|
|
calcNextRotate([OneSpec | Spec], NDate, NTime, NowDataTime) -> |
|
|
|
|
|
{NHour, NMinute, _} = NTime, |
|
|
|
|
|
case OneSpec of |
|
|
|
|
|
{minute, SMinute} -> |
|
|
|
|
|
case NMinute < SMinute of |
|
|
|
|
|
true -> |
|
|
|
|
|
%% rotation is this hour |
|
|
|
|
|
calcNextRotate(Spec, NDate, {NHour, SMinute, 0}, NowDataTime); |
|
|
|
|
|
_ -> |
|
|
|
|
|
%% rotation is next hour |
|
|
|
|
|
NexSec = utTime:lDateTimeToSec(NowDataTime) + 3600, |
|
|
|
|
|
{NNDate, NNTime} = utTime:secToLDateTime(NexSec), |
|
|
|
|
|
{NewHour, _, _} = NNTime, |
|
|
|
|
|
calcNextRotate(Spec, NNDate, {NewHour, SMinute, 0}, NowDataTime) |
|
|
|
|
|
end; |
|
|
|
|
|
{hour, SHour} -> |
|
|
|
|
|
case NHour < SHour of |
|
|
|
|
|
true -> |
|
|
|
|
|
%% rotation is today, sometime |
|
|
|
|
|
calcNextRotate(Spec, NDate, {SHour, 0, 0}, NowDataTime); |
|
|
|
|
|
_ -> |
|
|
|
|
|
%% rotation is not today |
|
|
|
|
|
NexSec = utTime:lDateTimeToSec(NowDataTime) + 86400, |
|
|
|
|
|
{NNDate, _NNTime} = utTime:secToLDateTime(NexSec), |
|
|
|
|
|
calcNextRotate(Spec, NNDate, {SHour, 0, 0}, NowDataTime) |
|
|
|
|
|
end; |
|
|
|
|
|
{day, SDay} -> |
|
|
|
|
|
CurDay = utTime:weekDay(NDate), |
|
|
|
|
|
AdjustedDay = |
|
|
|
|
|
case SDay of |
|
|
|
|
|
0 -> 7; |
|
|
|
|
|
_ -> SDay |
|
|
|
|
|
end, |
|
|
|
|
|
case AdjustedDay of |
|
|
|
|
|
CurDay -> %% rotation is today |
|
|
|
|
|
case calcNextRotate(T, Now) of |
|
|
|
|
|
{Date, _} = NewNow -> NewNow; |
|
|
|
|
|
{NewDate, _} -> |
|
|
|
|
|
%% rotation *isn't* today! rerun the calculation |
|
|
|
|
|
NewNow = {NewDate, {0, 0, 0}}, |
|
|
|
|
|
calcNextRotate([{day, SDay} | T], NewNow) |
|
|
|
|
|
end; |
|
|
|
|
|
Y when Y > CurDay -> %% rotation is later this week |
|
|
|
|
|
PlusDays = Y - CurDay, |
|
|
|
|
|
Seconds = calendar:datetime_to_gregorian_seconds(Now) + (86400 * PlusDays), |
|
|
|
|
|
{NewDate, _} = calendar:gregorian_seconds_to_datetime(Seconds), |
|
|
|
|
|
NewNow = {NewDate, {0, 0, 0}}, |
|
|
|
|
|
calcNextRotate(T, NewNow); |
|
|
|
|
|
Y when Y < CurDay -> %% rotation is next week |
|
|
|
|
|
PlusDays = ((7 - CurDay) + Y), |
|
|
|
|
|
Seconds = calendar:datetime_to_gregorian_seconds(Now) + (86400 * PlusDays), |
|
|
|
|
|
{NewDate, _} = calendar:gregorian_seconds_to_datetime(Seconds), |
|
|
|
|
|
NewNow = {NewDate, {0, 0, 0}}, |
|
|
|
|
|
calcNextRotate(T, NewNow) |
|
|
|
|
|
end; |
|
|
|
|
|
|
|
|
|
|
|
end; |
|
|
|
|
|
calcNextRotate([{day, SDay} | T], {Date, _Time} = Now) -> |
|
|
|
|
|
CurDay = calendar:day_of_the_week(Date), |
|
|
|
|
|
AdjustedDay = case SDay of |
|
|
0 -> 7; |
|
|
0 -> 7; |
|
|
X -> X |
|
|
X -> X |
|
|
end, |
|
|
end, |
|
|
case AdjustedDay of |
|
|
case AdjustedDay of |
|
|
DoW -> %% rotation is today |
|
|
|
|
|
case calculate_next_rotation(T, Now) of |
|
|
|
|
|
|
|
|
CurDay -> %% rotation is today |
|
|
|
|
|
case calcNextRotate(T, Now) of |
|
|
{Date, _} = NewNow -> NewNow; |
|
|
{Date, _} = NewNow -> NewNow; |
|
|
{NewDate, _} -> |
|
|
{NewDate, _} -> |
|
|
%% rotation *isn't* today! rerun the calculation |
|
|
%% rotation *isn't* today! rerun the calculation |
|
|
NewNow = {NewDate, {0, 0, 0}}, |
|
|
NewNow = {NewDate, {0, 0, 0}}, |
|
|
calculate_next_rotation([{day, Day} | T], NewNow) |
|
|
|
|
|
|
|
|
calcNextRotate([{day, SDay} | T], NewNow) |
|
|
end; |
|
|
end; |
|
|
Y when Y > DoW -> %% rotation is later this week |
|
|
|
|
|
PlusDays = Y - DoW, |
|
|
|
|
|
|
|
|
Y when Y > CurDay -> %% rotation is later this week |
|
|
|
|
|
PlusDays = Y - CurDay, |
|
|
Seconds = calendar:datetime_to_gregorian_seconds(Now) + (86400 * PlusDays), |
|
|
Seconds = calendar:datetime_to_gregorian_seconds(Now) + (86400 * PlusDays), |
|
|
{NewDate, _} = calendar:gregorian_seconds_to_datetime(Seconds), |
|
|
{NewDate, _} = calendar:gregorian_seconds_to_datetime(Seconds), |
|
|
NewNow = {NewDate, {0, 0, 0}}, |
|
|
NewNow = {NewDate, {0, 0, 0}}, |
|
|
calculate_next_rotation(T, NewNow); |
|
|
|
|
|
Y when Y < DoW -> %% rotation is next week |
|
|
|
|
|
PlusDays = ((7 - DoW) + Y), |
|
|
|
|
|
|
|
|
calcNextRotate(T, NewNow); |
|
|
|
|
|
Y when Y < CurDay -> %% rotation is next week |
|
|
|
|
|
PlusDays = ((7 - CurDay) + Y), |
|
|
Seconds = calendar:datetime_to_gregorian_seconds(Now) + (86400 * PlusDays), |
|
|
Seconds = calendar:datetime_to_gregorian_seconds(Now) + (86400 * PlusDays), |
|
|
{NewDate, _} = calendar:gregorian_seconds_to_datetime(Seconds), |
|
|
{NewDate, _} = calendar:gregorian_seconds_to_datetime(Seconds), |
|
|
NewNow = {NewDate, {0, 0, 0}}, |
|
|
NewNow = {NewDate, {0, 0, 0}}, |
|
|
calculate_next_rotation(T, NewNow) |
|
|
|
|
|
|
|
|
calcNextRotate(T, NewNow) |
|
|
end; |
|
|
end; |
|
|
calculate_next_rotation([{date, last} | T], {{Year, Month, Day}, _} = Now) -> |
|
|
|
|
|
|
|
|
calcNextRotate([{date, last} | T], {{Year, Month, Day}, _} = Now) -> |
|
|
Last = calendar:last_day_of_the_month(Year, Month), |
|
|
Last = calendar:last_day_of_the_month(Year, Month), |
|
|
case Last == Day of |
|
|
case Last == Day of |
|
|
true -> %% doing rotation today |
|
|
true -> %% doing rotation today |
|
|
case calculate_next_rotation(T, Now) of |
|
|
|
|
|
|
|
|
case calcNextRotate(T, Now) of |
|
|
{{Year, Month, Day}, _} = NewNow -> NewNow; |
|
|
{{Year, Month, Day}, _} = NewNow -> NewNow; |
|
|
{NewDate, _} -> |
|
|
{NewDate, _} -> |
|
|
%% rotation *isn't* today! rerun the calculation |
|
|
%% rotation *isn't* today! rerun the calculation |
|
|
NewNow = {NewDate, {0, 0, 0}}, |
|
|
NewNow = {NewDate, {0, 0, 0}}, |
|
|
calculate_next_rotation([{date, last} | T], NewNow) |
|
|
|
|
|
|
|
|
calcNextRotate([{date, last} | T], NewNow) |
|
|
end; |
|
|
end; |
|
|
false -> |
|
|
false -> |
|
|
NewNow = setelement(1, Now, {Year, Month, Last}), |
|
|
NewNow = setelement(1, Now, {Year, Month, Last}), |
|
|
calculate_next_rotation(T, NewNow) |
|
|
|
|
|
|
|
|
calcNextRotate(T, NewNow) |
|
|
end; |
|
|
end; |
|
|
calculate_next_rotation([{date, Date} | T], {{Year, Month, Date}, _} = Now) -> |
|
|
|
|
|
|
|
|
calcNextRotate([{date, Date} | T], {{Year, Month, Date}, _} = Now) -> |
|
|
%% rotation is today |
|
|
%% rotation is today |
|
|
case calculate_next_rotation(T, Now) of |
|
|
|
|
|
|
|
|
case calcNextRotate(T, Now) of |
|
|
{{Year, Month, Date}, _} = NewNow -> NewNow; |
|
|
{{Year, Month, Date}, _} = NewNow -> NewNow; |
|
|
{NewDate, _} -> |
|
|
{NewDate, _} -> |
|
|
%% rotation *isn't* today! rerun the calculation |
|
|
%% rotation *isn't* today! rerun the calculation |
|
|
NewNow = setelement(1, Now, NewDate), |
|
|
NewNow = setelement(1, Now, NewDate), |
|
|
calculate_next_rotation([{date, Date} | T], NewNow) |
|
|
|
|
|
|
|
|
calcNextRotate([{date, Date} | T], NewNow) |
|
|
end; |
|
|
end; |
|
|
calculate_next_rotation([{date, Date} | T], {{Year, Month, Day}, _} = Now) -> |
|
|
|
|
|
|
|
|
calcNextRotate([{date, Date} | T], {{Year, Month, Day}, _} = Now) -> |
|
|
PlusDays = case Date of |
|
|
PlusDays = case Date of |
|
|
X when X < Day -> %% rotation is next month |
|
|
X when X < Day -> %% rotation is next month |
|
|
Last = calendar:last_day_of_the_month(Year, Month), |
|
|
Last = calendar:last_day_of_the_month(Year, Month), |
|
@ -353,7 +389,7 @@ calculate_next_rotation([{date, Date} | T], {{Year, Month, Day}, _} = Now) -> |
|
|
end, |
|
|
end, |
|
|
Seconds = calendar:datetime_to_gregorian_seconds(Now) + (86400 * PlusDays), |
|
|
Seconds = calendar:datetime_to_gregorian_seconds(Now) + (86400 * PlusDays), |
|
|
NewNow = calendar:gregorian_seconds_to_datetime(Seconds), |
|
|
NewNow = calendar:gregorian_seconds_to_datetime(Seconds), |
|
|
calculate_next_rotation(T, NewNow). |
|
|
|
|
|
|
|
|
calcNextRotate(T, NewNow). |
|
|
|
|
|
|
|
|
-spec trace_filter(Query :: 'none' | [tuple()]) -> {ok, any()}. |
|
|
-spec trace_filter(Query :: 'none' | [tuple()]) -> {ok, any()}. |
|
|
trace_filter(Query) -> |
|
|
trace_filter(Query) -> |
|
@ -595,18 +631,6 @@ discard_messages(Second, Filter, Count) -> |
|
|
makeInnerSinkName(Sink) -> |
|
|
makeInnerSinkName(Sink) -> |
|
|
binary_to_atom(<<(atom_to_binary(Sink, utf8))/binary, "Event">>). |
|
|
binary_to_atom(<<(atom_to_binary(Sink, utf8))/binary, "Event">>). |
|
|
|
|
|
|
|
|
-spec otp_version() -> pos_integer(). |
|
|
|
|
|
%% @doc Return the major version of the current Erlang/OTP runtime as an integer. |
|
|
|
|
|
otp_version() -> |
|
|
|
|
|
{Vsn, _} = string:to_integer( |
|
|
|
|
|
case erlang:system_info(otp_release) of |
|
|
|
|
|
[$R | Rel] -> |
|
|
|
|
|
Rel; |
|
|
|
|
|
Rel -> |
|
|
|
|
|
Rel |
|
|
|
|
|
end), |
|
|
|
|
|
Vsn. |
|
|
|
|
|
|
|
|
|
|
|
maybe_flush(undefined, #rumShaper{} = S) -> |
|
|
maybe_flush(undefined, #rumShaper{} = S) -> |
|
|
S; |
|
|
S; |
|
|
maybe_flush(Flag, #rumShaper{} = S) when is_boolean(Flag) -> |
|
|
maybe_flush(Flag, #rumShaper{} = S) when is_boolean(Flag) -> |
|
@ -673,58 +697,58 @@ parse_fail_test() -> |
|
|
|
|
|
|
|
|
rotation_calculation_test() -> |
|
|
rotation_calculation_test() -> |
|
|
?assertMatch({{2000, 1, 1}, {13, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 1}, {13, 0, 0}}, |
|
|
calculate_next_rotation([{minute, 0}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{minute, 0}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
?assertMatch({{2000, 1, 1}, {12, 45, 0}}, |
|
|
?assertMatch({{2000, 1, 1}, {12, 45, 0}}, |
|
|
calculate_next_rotation([{minute, 45}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{minute, 45}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
?assertMatch({{2000, 1, 2}, {0, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 2}, {0, 0, 0}}, |
|
|
calculate_next_rotation([{minute, 0}], {{2000, 1, 1}, {23, 45, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{minute, 0}], {{2000, 1, 1}, {23, 45, 43}})), |
|
|
?assertMatch({{2000, 1, 2}, {0, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 2}, {0, 0, 0}}, |
|
|
calculate_next_rotation([{hour, 0}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{hour, 0}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
?assertMatch({{2000, 1, 1}, {16, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 1}, {16, 0, 0}}, |
|
|
calculate_next_rotation([{hour, 16}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{hour, 16}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
?assertMatch({{2000, 1, 2}, {12, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 2}, {12, 0, 0}}, |
|
|
calculate_next_rotation([{hour, 12}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{hour, 12}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
?assertMatch({{2000, 2, 1}, {12, 0, 0}}, |
|
|
?assertMatch({{2000, 2, 1}, {12, 0, 0}}, |
|
|
calculate_next_rotation([{date, 1}, {hour, 12}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{date, 1}, {hour, 12}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
?assertMatch({{2000, 2, 1}, {12, 0, 0}}, |
|
|
?assertMatch({{2000, 2, 1}, {12, 0, 0}}, |
|
|
calculate_next_rotation([{date, 1}, {hour, 12}], {{2000, 1, 15}, {12, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{date, 1}, {hour, 12}], {{2000, 1, 15}, {12, 34, 43}})), |
|
|
?assertMatch({{2000, 2, 1}, {12, 0, 0}}, |
|
|
?assertMatch({{2000, 2, 1}, {12, 0, 0}}, |
|
|
calculate_next_rotation([{date, 1}, {hour, 12}], {{2000, 1, 2}, {12, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{date, 1}, {hour, 12}], {{2000, 1, 2}, {12, 34, 43}})), |
|
|
?assertMatch({{2000, 2, 1}, {12, 0, 0}}, |
|
|
?assertMatch({{2000, 2, 1}, {12, 0, 0}}, |
|
|
calculate_next_rotation([{date, 1}, {hour, 12}], {{2000, 1, 31}, {12, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{date, 1}, {hour, 12}], {{2000, 1, 31}, {12, 34, 43}})), |
|
|
?assertMatch({{2000, 1, 1}, {16, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 1}, {16, 0, 0}}, |
|
|
calculate_next_rotation([{date, 1}, {hour, 16}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{date, 1}, {hour, 16}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
?assertMatch({{2000, 1, 15}, {16, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 15}, {16, 0, 0}}, |
|
|
calculate_next_rotation([{date, 15}, {hour, 16}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{date, 15}, {hour, 16}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
?assertMatch({{2000, 1, 31}, {16, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 31}, {16, 0, 0}}, |
|
|
calculate_next_rotation([{date, last}, {hour, 16}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{date, last}, {hour, 16}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
?assertMatch({{2000, 1, 31}, {16, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 31}, {16, 0, 0}}, |
|
|
calculate_next_rotation([{date, last}, {hour, 16}], {{2000, 1, 31}, {12, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{date, last}, {hour, 16}], {{2000, 1, 31}, {12, 34, 43}})), |
|
|
?assertMatch({{2000, 2, 29}, {16, 0, 0}}, |
|
|
?assertMatch({{2000, 2, 29}, {16, 0, 0}}, |
|
|
calculate_next_rotation([{date, last}, {hour, 16}], {{2000, 1, 31}, {17, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{date, last}, {hour, 16}], {{2000, 1, 31}, {17, 34, 43}})), |
|
|
?assertMatch({{2001, 2, 28}, {16, 0, 0}}, |
|
|
?assertMatch({{2001, 2, 28}, {16, 0, 0}}, |
|
|
calculate_next_rotation([{date, last}, {hour, 16}], {{2001, 1, 31}, {17, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{date, last}, {hour, 16}], {{2001, 1, 31}, {17, 34, 43}})), |
|
|
|
|
|
|
|
|
?assertMatch({{2000, 1, 1}, {16, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 1}, {16, 0, 0}}, |
|
|
calculate_next_rotation([{day, 6}, {hour, 16}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{day, 6}, {hour, 16}], {{2000, 1, 1}, {12, 34, 43}})), |
|
|
?assertMatch({{2000, 1, 8}, {16, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 8}, {16, 0, 0}}, |
|
|
calculate_next_rotation([{day, 6}, {hour, 16}], {{2000, 1, 1}, {17, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{day, 6}, {hour, 16}], {{2000, 1, 1}, {17, 34, 43}})), |
|
|
?assertMatch({{2000, 1, 7}, {16, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 7}, {16, 0, 0}}, |
|
|
calculate_next_rotation([{day, 5}, {hour, 16}], {{2000, 1, 1}, {17, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{day, 5}, {hour, 16}], {{2000, 1, 1}, {17, 34, 43}})), |
|
|
?assertMatch({{2000, 1, 3}, {16, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 3}, {16, 0, 0}}, |
|
|
calculate_next_rotation([{day, 1}, {hour, 16}], {{2000, 1, 1}, {17, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{day, 1}, {hour, 16}], {{2000, 1, 1}, {17, 34, 43}})), |
|
|
?assertMatch({{2000, 1, 2}, {16, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 2}, {16, 0, 0}}, |
|
|
calculate_next_rotation([{day, 0}, {hour, 16}], {{2000, 1, 1}, {17, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{day, 0}, {hour, 16}], {{2000, 1, 1}, {17, 34, 43}})), |
|
|
?assertMatch({{2000, 1, 9}, {16, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 9}, {16, 0, 0}}, |
|
|
calculate_next_rotation([{day, 0}, {hour, 16}], {{2000, 1, 2}, {17, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{day, 0}, {hour, 16}], {{2000, 1, 2}, {17, 34, 43}})), |
|
|
?assertMatch({{2000, 2, 3}, {16, 0, 0}}, |
|
|
?assertMatch({{2000, 2, 3}, {16, 0, 0}}, |
|
|
calculate_next_rotation([{day, 4}, {hour, 16}], {{2000, 1, 29}, {17, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{day, 4}, {hour, 16}], {{2000, 1, 29}, {17, 34, 43}})), |
|
|
|
|
|
|
|
|
?assertMatch({{2000, 1, 7}, {16, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 7}, {16, 0, 0}}, |
|
|
calculate_next_rotation([{day, 5}, {hour, 16}], {{2000, 1, 3}, {17, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{day, 5}, {hour, 16}], {{2000, 1, 3}, {17, 34, 43}})), |
|
|
|
|
|
|
|
|
?assertMatch({{2000, 1, 3}, {16, 0, 0}}, |
|
|
?assertMatch({{2000, 1, 3}, {16, 0, 0}}, |
|
|
calculate_next_rotation([{day, 1}, {hour, 16}], {{1999, 12, 28}, {17, 34, 43}})), |
|
|
|
|
|
|
|
|
calcNextRotate([{day, 1}, {hour, 16}], {{1999, 12, 28}, {17, 34, 43}})), |
|
|
ok. |
|
|
ok. |
|
|
|
|
|
|
|
|
check_trace_test() -> |
|
|
check_trace_test() -> |
|
@ -913,16 +937,14 @@ delete_test_dir() -> |
|
|
|
|
|
|
|
|
delete_test_dir(TestDir) -> |
|
|
delete_test_dir(TestDir) -> |
|
|
ok = application:unset_env(lager, test_dir), |
|
|
ok = application:unset_env(lager, test_dir), |
|
|
{OsType, _} = os:type(), |
|
|
|
|
|
ok = case {OsType, otp_version()} of |
|
|
|
|
|
{win32, _} -> |
|
|
|
|
|
application:stop(lager), |
|
|
|
|
|
do_delete_test_dir(TestDir); |
|
|
|
|
|
{unix, 15} -> |
|
|
|
|
|
os:cmd("rm -rf " ++ TestDir); |
|
|
|
|
|
{unix, _} -> |
|
|
|
|
|
do_delete_test_dir(TestDir) |
|
|
|
|
|
end. |
|
|
|
|
|
|
|
|
ok = |
|
|
|
|
|
case os:type() of |
|
|
|
|
|
{win32, _} -> |
|
|
|
|
|
application:stop(lager), |
|
|
|
|
|
do_delete_test_dir(TestDir); |
|
|
|
|
|
{_, _} -> |
|
|
|
|
|
do_delete_test_dir(TestDir) |
|
|
|
|
|
end. |
|
|
|
|
|
|
|
|
do_delete_test_dir(Dir) -> |
|
|
do_delete_test_dir(Dir) -> |
|
|
ListRet = file:list_dir_all(Dir), |
|
|
ListRet = file:list_dir_all(Dir), |
|
|