Skip to content

Commit f171a84

Browse files
committed
better zone time support
1 parent ea91992 commit f171a84

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/services/FactorGraph.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,14 +589,17 @@ function addVariable!(
589589
#
590590
varType = _variableType(varTypeU)
591591

592+
_zonedtime(s::DateTime) = ZonedDateTime(s, localzone())
593+
_zonedtime(s::ZonedDateTime) = s
594+
592595
union!(tags, [:VARIABLE])
593596
v = DFGVariable(
594597
label,
595598
varType;
596599
tags = Set(tags),
597600
smallData = smalldata,
598601
solvable = solvable,
599-
timestamp = timestamp,
602+
timestamp = _zonedtime(timestamp),
600603
nstime = Nanosecond(nanosecondtime),
601604
)
602605

@@ -825,6 +828,9 @@ function DFG.addFactor!(
825828

826829
@assert (suppressChecks || length(multihypo) === 0 || length(multihypo) == length(Xi)) "When using multihypo=[...], the number of variables and multihypo probabilies must match. See documentation on how to include fractional data-association uncertainty."
827830

831+
_zonedtime(s::ZonedDateTime) = s
832+
_zonedtime(s::DateTime) = ZonedDateTime(s, localzone())
833+
828834
varOrderLabels = Symbol[v.label for v in Xi]
829835
solverData = getDefaultFactorData(
830836
dfg,
@@ -843,7 +849,7 @@ function DFG.addFactor!(
843849
solverData;
844850
tags = Set(union(tags, [:FACTOR])),
845851
solvable,
846-
timestamp,
852+
timestamp = _zonedtime(timestamp),
847853
)
848854
#
849855

@@ -879,7 +885,7 @@ function DFG.addFactor!(
879885

880886
# variables = getVariable.(dfg, vlbs)
881887
variables = map(vid -> getVariable(dfg, vid), vlbs)
882-
return addFactor!(dfg, variables, usrfnc; suppressChecks = suppressChecks, kw...)
888+
return addFactor!(dfg, variables, usrfnc; suppressChecks, kw...)
883889
end
884890

885891
#

0 commit comments

Comments
 (0)