Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LimaGroup
Lima
Commits
ca4f9f82
Commit
ca4f9f82
authored
Oct 09, 2020
by
Samuel Debionne
Committed by
Samuel Debionne
Oct 20, 2020
Browse files
Fix data race in non-thread-safe gmtime (Linux), use gmtime_r instead
parent
a7101e12
Changes
1
Hide whitespace changes
Inline
Side-by-side
control/src/CtSaving_Hdf5.cpp
View file @
ca4f9f82
...
...
@@ -362,13 +362,13 @@ void* SaveContainerHdf5::_open(const std::string &filename, std::ios_base::openm
time_t
now
;
time
(
&
now
);
char
buf
[
sizeof
(
"2011-10-08T07:07:09Z"
)];
#ifdef WIN32
struct
tm
gmtime_now
;
#ifdef WIN32
gmtime_s
(
&
gmtime_now
,
&
now
);
strftime
(
buf
,
sizeof
(
buf
),
"%FT%TZ"
,
&
gmtime_now
);
#else
strftime
(
buf
,
sizeof
(
buf
),
"%FT%TZ"
,
gmtime
(
&
now
)
)
;
gmtime_r
(
&
now
,
&
gmtime
_
now
);
#endif
strftime
(
buf
,
sizeof
(
buf
),
"%FT%TZ"
,
&
gmtime_now
);
string
stime
=
string
(
buf
);
write_h5_attribute
(
file
->
m_file
,
"file_time"
,
stime
);
...
...
@@ -527,13 +527,13 @@ void SaveContainerHdf5::_close(void* f) {
time_t
now
;
time
(
&
now
);
char
buf
[
sizeof
(
"2011-10-08T07:07:09Z"
)];
#ifdef WIN32
struct
tm
gmtime_now
;
#ifdef WIN32
gmtime_s
(
&
gmtime_now
,
&
now
);
strftime
(
buf
,
sizeof
(
buf
),
"%FT%TZ"
,
&
gmtime_now
);
#else
strftime
(
buf
,
sizeof
(
buf
),
"%FT%TZ"
,
gmtime
(
&
now
)
)
;
gmtime_r
(
&
now
,
&
gmtime
_
now
);
#endif
strftime
(
buf
,
sizeof
(
buf
),
"%FT%TZ"
,
&
gmtime_now
);
string
etime
=
string
(
buf
);
write_h5_dataset
(
file
->
m_entry
,
"end_time"
,
etime
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment