Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/MAT_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,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 to_matlab_data(d::DateTime)
Expand Down
4 changes: 4 additions & 0 deletions test/read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ for format in ["v7", "v7.3"]
@test dt isa DateTime
@test dt - DateTime(2019, 12, 2, 16, 42, 49) < Second(1)

@test "testDatetimeComplex" in keys(vars)
dtc = vars["testDatetimeComplex"]
@test dtc isa DateTime

# test no conversion at all
vars = matread(filepath; convert_opaque=false)["s"]
t = vars["testTable"]
Expand Down
Binary file modified test/v7.3/struct_table_datetime.mat
Binary file not shown.
Binary file modified test/v7/struct_table_datetime.mat
Binary file not shown.
Loading