Skip to content

Commit ae78a5c

Browse files
author
pitx-perf
committed
Make isclock robust to non TimeDomain argument
1 parent c568c0e commit ae78a5c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/clock.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ discrete-time systems that assume a fixed sample time, such as PID controllers a
4040
filters.
4141
""" SolverStepClock
4242

43-
isclock(c) = @match c begin
43+
isclock(c) = isa(c, TimeDomain) && @match c begin
4444
PeriodicClock() => true
4545
_ => false
4646
end

test/clock.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ using MLStyle: @match
1919
@test isclock(PeriodicClock(; dt = 1.0))
2020
@test !isclock(Continuous())
2121
@test !isclock(SolverStepClock())
22+
@test !isclock(nothing)
2223

2324
@test !issolverstepclock(PeriodicClock(; dt = 1.0))
2425
@test !issolverstepclock(Continuous())

0 commit comments

Comments
 (0)