Skip to content

Commit 2943cf0

Browse files
committed
updated test blocks to use TimeZone
1 parent d662332 commit 2943cf0

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/services/CommonAccessors.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,16 @@ Note:
6262
Since `timestamp` is not mutable `setTimestamp!` calls `updateVariable!` internally.
6363
See also [`setTimestamp`](@ref)
6464
"""
65-
function setTimestamp!(dfg::AbstractDFG, lbl::Symbol, ts::DateTime)
65+
function setTimestamp!(dfg::AbstractDFG, lbl::Symbol, ts::ZonedDateTime)
6666
if isVariable(dfg, lbl)
67-
return updateVariable!(dfg, setTimestamp(getVariable(dfg,lbl), ts))
67+
return updateVariable!(dfg, setTimestamp(getVariable(dfg,lbl), ts; verbose=false))
6868
else
6969
return updateFactor!(dfg, setTimestamp(getFactor(dfg,lbl), ts))
7070
end
7171
end
7272

73+
setTimestamp!(dfg::AbstractDFG, lbl::Symbol, ts::DateTime, timezone=localzone()) = setTimestamp!(dfg, lbl, ZonedDateTime(ts, timezone))
74+
7375

7476

7577
##------------------------------------------------------------------------------

test/LightDFGSummaryTypes.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ end
4646
@test getSofttypename(v1) == :Pose2
4747

4848
# FACTYPE == DFGFactorSummary
49-
testTimestamp = now()
49+
testTimestamp = now(localzone())
5050
v1ts = setTimestamp(v1, testTimestamp)
5151
@test getTimestamp(v1ts) == testTimestamp
5252
#follow with updateVariable!(fg, v1ts)

test/testBlocks.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ function DFGVariableSCA()
237237
v1_lbl = :a
238238
v1_tags = Set([:VARIABLE, :POSE])
239239
small = Dict("small"=>"data")
240-
testTimestamp = now()
240+
testTimestamp = now(localzone())
241241
# Constructors
242242
v1 = DFGVariable(v1_lbl, TestSofttype1(), tags=v1_tags, solvable=0, solverDataDict=Dict(:default=>VariableNodeData{TestSofttype1}()))
243243
v2 = DFGVariable(:b, VariableNodeData{TestSofttype2}(), tags=Set([:VARIABLE, :LANDMARK]))
@@ -313,7 +313,7 @@ function DFGFactorSCA()
313313
#DFGVariable solvable default to 1, but Factor to 0, is that correct
314314
f1_lbl = :abf1
315315
f1_tags = Set([:FACTOR])
316-
testTimestamp = now()
316+
testTimestamp = now(localzone())
317317

318318
gfnd_prior = GenericFunctionNodeData(false, false, Int[], TestCCW(TestAbstractPrior()))
319319

@@ -423,7 +423,7 @@ end
423423

424424
# Extra timestamp functions https://github.com/JuliaRobotics/DistributedFactorGraphs.jl/issues/315
425425
if !(v1 isa SkeletonDFGVariable)
426-
newtimestamp = now()
426+
newtimestamp = now(localzone())
427427
@test !(setTimestamp!(fg, :c, newtimestamp) === v3)
428428
@test getVariable(fg, :c) |> getTimestamp == newtimestamp
429429

0 commit comments

Comments
 (0)