Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
diapotb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Remote Modules
diapotb
Commits
ae93ccd2
Commit
ae93ccd2
authored
4 years ago
by
Gaëlle USSEGLIO
Browse files
Options
Downloads
Patches
Plain Diff
BUG : Remove strptime from C++ code (issue
#9
) with std::get_time
parent
dd2dfc31
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!38
Fix strptime
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+0
-2
0 additions, 2 deletions
CMakeLists.txt
app/CMakeLists.txt
+1
-1
1 addition, 1 deletion
app/CMakeLists.txt
app/otbSARMetadataCorrection.cxx
+14
-14
14 additions, 14 deletions
app/otbSARMetadataCorrection.cxx
with
15 additions
and
17 deletions
CMakeLists.txt
+
0
−
2
View file @
ae93ccd2
...
...
@@ -2,13 +2,11 @@ cmake_minimum_required(VERSION 2.8.9)
project
(
DiapOTBModule
)
if
(
NOT OTB_SOURCE_DIR
)
find_package
(
Boost COMPONENTS date_time
)
find_package
(
OTB REQUIRED
)
list
(
APPEND CMAKE_MODULE_PATH
${
OTB_CMAKE_DIR
}
)
include
(
${
OTB_USE_FILE
}
)
include
(
OTBModuleExternal
)
else
()
find_package
(
Boost COMPONENTS date_time
)
otb_module_impl
()
endif
()
...
...
This diff is collapsed.
Click to expand it.
app/CMakeLists.txt
+
1
−
1
View file @
ae93ccd2
...
...
@@ -102,7 +102,7 @@ OTB_CREATE_APPLICATION(NAME SARCorrelationRough
OTB_CREATE_APPLICATION
(
NAME SARMetadataCorrection
SOURCES otbSARMetadataCorrection.cxx
LINK_LIBRARIES
${${
otb-module
}
_LIBRARIES
}
${
Boost_LIBRARIES
}
LINK_LIBRARIES
${${
otb-module
}
_LIBRARIES
}
)
OTB_CREATE_APPLICATION
(
NAME SAROrthoInterferogram
...
...
This diff is collapsed.
Click to expand it.
app/otbSARMetadataCorrection.cxx
+
14
−
14
View file @
ae93ccd2
...
...
@@ -24,6 +24,7 @@
#include
"otbSARStreamingDEMClosestHgtFilter.h"
#include
<iostream>
#include
<iomanip>
#include
<string>
#include
<fstream>
#include
<complex>
...
...
@@ -33,8 +34,6 @@
#include
"otb_tinyxml.h"
#include
"itksys/SystemTools.hxx"
#include
"boost/date_time/posix_time/posix_time.hpp"
// include ossim
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
...
...
@@ -378,27 +377,28 @@ int selectOrbits(std::vector<std::string> * vector_time,
std
::
string
UTC_last
=
inKWL
.
GetMetadataByKey
(
std
::
string
(
prefix_last
));
// Transform string to t_time (in seconds)
struct
tm
tm1
;
struct
tm
tm2
;
UTC_first
.
replace
(
UTC_first
.
find
(
"T"
),
1
,
" "
);
tm1
=
boost
::
posix_time
::
to_tm
(
boost
::
posix_time
::
time_from_string
(
UTC_first
.
c_str
()));
std
::
tm
tm1
=
{};
std
::
tm
tm2
=
{};
std
::
istringstream
UTC_first_ss
(
UTC_first
);
UTC_first_ss
.
imbue
(
std
::
locale
(
setlocale
(
LC_ALL
,
nullptr
)));
UTC_first_ss
>>
std
::
get_time
(
&
tm1
,
"%Y-%m-%dT%H:%M:%SZ"
);
time_t
t_first
=
mktime
(
&
tm1
);
UTC_last
.
replace
(
UTC_last
.
find
(
"T"
),
1
,
" "
);
tm2
=
boost
::
posix_time
::
to_tm
(
boost
::
posix_time
::
time_from_string
(
UTC_last
.
c_str
()));
std
::
istringstream
UTC_last_ss
(
UTC_last
);
UTC_last_ss
.
imbue
(
std
::
locale
(
setlocale
(
LC_ALL
,
nullptr
)));
UTC_last_ss
>>
std
::
get_time
(
&
tm2
,
"%Y-%m-%dT%H:%M:%SZ"
);
time_t
t_last
=
mktime
(
&
tm2
);
// Selection of indexes into vector_time
// ind_first = last elt to be inferior to t_first
// ind_last = first elt to be superior to t_last
for
(
unsigned
int
i
=
0
;
i
<
vector_time
->
size
();
i
++
)
{
struct
tm
tm
;
std
::
string
UTC_i
=
vector_time
->
at
(
i
);
// Copy of UTC at ind i to keep original time into our vector
UTC_i
.
replace
(
UTC_i
.
find
(
"T"
),
1
,
" "
);
tm
=
boost
::
posix_time
::
to_tm
(
boost
::
posix_time
::
time_from_string
(
UTC_i
.
c_str
()));
std
::
tm
tm
;
std
::
istringstream
UTC_ss
(
vector_time
->
at
(
i
));
UTC_ss
>>
std
::
get_time
(
&
tm
,
"%Y-%m-%dT%H:%M:%SZ"
);
time_t
t
=
mktime
(
&
tm
);
if
(
difftime
(
t
,
t_first
)
>
0
&&
ind_first
==
0
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment