diff --git a/src/MAT_subsys.jl b/src/MAT_subsys.jl index 906c480..f70b23e 100644 --- a/src/MAT_subsys.jl +++ b/src/MAT_subsys.jl @@ -302,10 +302,13 @@ end function get_dynamic_properties(subsys::Subsystem, dep_id::UInt32) - if length(subsys.dynprop_metadata) == 0 + if dep_id == UInt32(0) return Dict{String,Any}() end + # dynprops metadata is stored in format + # [(nprops, prop_obj_id_1, ..., prop_obj_id_n), ...] for each dep_id + offset = 1 while dep_id > 0 nprops = subsys.dynprop_metadata[offset] @@ -318,7 +321,7 @@ function get_dynamic_properties(subsys::Subsystem, dep_id::UInt32) offset += 1 dyn_prop_obj_ids = subsys.dynprop_metadata[offset:(offset + ndynprops - 1)] - if dyn_prop_obj_ids == UInt32[] + if length(dyn_prop_obj_ids) == 0 return Dict{String,Any}() end dyn_prop_map = Dict{String,Any}() @@ -338,7 +341,7 @@ function get_properties(subsys::Subsystem, object_id::UInt32) return Dict{String,Any}() end - class_id, _, _, saveobj_id, normobj_id, _ = get_object_metadata(subsys, object_id) + class_id, _, _, saveobj_id, normobj_id, dep_id = get_object_metadata(subsys, object_id) if saveobj_id != 0 saveobj_ret_type = true obj_type_id = saveobj_id @@ -349,7 +352,7 @@ function get_properties(subsys::Subsystem, object_id::UInt32) defaults = get_default_properties(subsys, class_id) prop_map = merge(defaults, get_saved_properties(subsys, obj_type_id, saveobj_ret_type)) - dyn_props = get_dynamic_properties(subsys, object_id) + dyn_props = get_dynamic_properties(subsys, dep_id) merge!(prop_map, dyn_props) return prop_map end diff --git a/src/MAT_types.jl b/src/MAT_types.jl index c7c5720..e8fdfd3 100644 --- a/src/MAT_types.jl +++ b/src/MAT_types.jl @@ -434,7 +434,7 @@ end ms_to_datetime(ms::Complex) = ms_to_datetime(real(ms)) function ms_to_datetime(ms::Real) s, ms_rem = fldmod(ms, 1_000) # whole seconds and remainder milliseconds - return DateTime(1970, 1, 1) + Second(s) + Millisecond(ms_rem) + return DateTime(1970, 1, 1) + Second(s) + Millisecond(round(Int, ms_rem)) end function from_duration(obj::MatlabOpaque)