Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Achim Morschhauser
GeomagLogger
Commits
f254a8bb
Commit
f254a8bb
authored
Dec 14, 2021
by
Achim Morschhauser
Browse files
Fix problem with showing HH:MM:60 as rounded time
parent
43f7d967
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/data_obs.cpp
View file @
f254a8bb
...
...
@@ -149,10 +149,10 @@ int data_obs::set_time(int year, int mon, int day, int hour, int min, int sec,
int
data_obs
::
set_time
(
struct
timespec
*
time
)
{
// Initialize tm
//TODO Make t a class-variable to avoid repeated allocation
struct
tm
t
=
{
0
};
//TODO Make t a class-variable to avoid repeated allocation
struct
tm
t
=
{
0
};
// Use gmtime_r for thread-safety
// Use gmtime_r for thread-safety
gmtime_r
(
&
time
->
tv_sec
,
&
t
);
year
=
t
.
tm_year
+
1900
;
...
...
@@ -295,6 +295,7 @@ std::string data_obs::get_time(std::string formatstr, bool rounded) const{
if
(
rounded
&&
data_obs
::
msec
>=
500e6
){
tm
.
tm_sec
+=
1
;
mktime
(
&
tm
);
}
// TODO This may be slow, possibly better to use sprintf and fixed
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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