Skip to content

Commit 2398736

Browse files
committed
convert to localzone() in DFGVariable constructors
1 parent be55c7c commit 2398736

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/entities/DFGVariable.jl

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,28 +214,38 @@ end
214214
$SIGNATURES
215215
The default DFGVariable constructor.
216216
"""
217-
DFGVariable(label::Symbol, softtype::T;
217+
function DFGVariable(label::Symbol, softtype::T;
218218
timestamp::Union{DateTime,ZonedDateTime}=now(localzone()),
219219
nstime::Nanosecond = Nanosecond(0),
220220
tags::Set{Symbol}=Set{Symbol}(),
221221
estimateDict::Dict{Symbol, <: AbstractPointParametricEst}=Dict{Symbol, MeanMaxPPE}(),
222222
solverDataDict::Dict{Symbol, VariableNodeData{T}}=Dict{Symbol, VariableNodeData{T}}(),
223223
smallData::Dict{String, String}=Dict{String, String}(),
224224
dataDict::Dict{Symbol, AbstractDataEntry}=Dict{Symbol,AbstractDataEntry}(),
225-
solvable::Int=1) where {T <: InferenceVariable} =
226-
DFGVariable{T}(label, timestamp, nstime, tags, estimateDict, solverDataDict, smallData, dataDict, Ref(solvable))
225+
solvable::Int=1) where {T <: InferenceVariable}
227226

227+
if timestamp isa DateTime
228+
DFGVariable{T}(label, ZonedDateTime(timestamp, localzone()), nstime, tags, estimateDict, solverDataDict, smallData, dataDict, Ref(solvable))
229+
else
230+
DFGVariable{T}(label, timestamp, nstime, tags, estimateDict, solverDataDict, smallData, dataDict, Ref(solvable))
231+
end
232+
end
228233

229-
DFGVariable(label::Symbol,
234+
function DFGVariable(label::Symbol,
230235
solverData::VariableNodeData{T};
231236
timestamp::Union{DateTime,ZonedDateTime}=now(localzone()),
232237
nstime::Nanosecond = Nanosecond(0),
233238
tags::Set{Symbol}=Set{Symbol}(),
234239
estimateDict::Dict{Symbol, <: AbstractPointParametricEst}=Dict{Symbol, MeanMaxPPE}(),
235240
smallData::Dict{String, String}=Dict{String, String}(),
236241
dataDict::Dict{Symbol, AbstractDataEntry}=Dict{Symbol,AbstractDataEntry}(),
237-
solvable::Int=1) where {T <: InferenceVariable} =
238-
DFGVariable{T}(label, timestamp, nstime, tags, estimateDict, Dict{Symbol, VariableNodeData{T}}(:default=>solverData), smallData, dataDict, Ref(solvable))
242+
solvable::Int=1) where {T <: InferenceVariable}
243+
if timestamp isa DateTime
244+
DFGVariable{T}(label, ZonedDateTime(timestamp, localzone()), nstime, tags, estimateDict, Dict{Symbol, VariableNodeData{T}}(:default=>solverData), smallData, dataDict, Ref(solvable))
245+
else
246+
DFGVariable{T}(label, timestamp, nstime, tags, estimateDict, Dict{Symbol, VariableNodeData{T}}(:default=>solverData), smallData, dataDict, Ref(solvable))
247+
end
248+
end
239249

240250
Base.getproperty(x::DFGVariable,f::Symbol) = begin
241251
if f == :solvable

0 commit comments

Comments
 (0)