Browse Source

Use of rawtime_s instead of rawtime to suppress MSVC warning

add-code-of-conduct-1
John Daily 6 years ago
parent
commit
429f27ac83
2 changed files with 13 additions and 3 deletions
  1. 2
    0
      Modules/FDEM1D/include/FHT.h
  2. 11
    3
      Modules/LemmaCore/include/LemmaObject.h

+ 2
- 0
Modules/FDEM1D/include/FHT.h View File

170
     }; // -----  end of class  FHT  ----
170
     }; // -----  end of class  FHT  ----
171
 
171
 
172
     // Forward declarations
172
     // Forward declarations
173
+/*
173
     template<>
174
     template<>
174
     const Eigen::Matrix<Real, Eigen::Dynamic, 3>  FHT<FHTKEY201>::WT;
175
     const Eigen::Matrix<Real, Eigen::Dynamic, 3>  FHT<FHTKEY201>::WT;
175
     template<>
176
     template<>
184
     const Eigen::Matrix<Real, Eigen::Dynamic, 3>  FHT<FHTKONG241>::WT;
185
     const Eigen::Matrix<Real, Eigen::Dynamic, 3>  FHT<FHTKONG241>::WT;
185
     template<>
186
     template<>
186
     const Eigen::Matrix<Real, Eigen::Dynamic, 3>  FHT<IRONS>::WT;
187
     const Eigen::Matrix<Real, Eigen::Dynamic, 3>  FHT<IRONS>::WT;
188
+*/
187
 
189
 
188
     template < HANKELTRANSFORMTYPE Type >
190
     template < HANKELTRANSFORMTYPE Type >
189
     Complex FHT<Type>::Zgauss(const int& ii, const Lemma::EMMODE& mode, const int& jj, const Real& val,
191
     Complex FHT<Type>::Zgauss(const int& ii, const Lemma::EMMODE& mode, const int& jj, const Real& val,

+ 11
- 3
Modules/LemmaCore/include/LemmaObject.h View File

18
 #include "yaml-cpp/yaml.h"
18
 #include "yaml-cpp/yaml.h"
19
 
19
 
20
 #include <chrono>
20
 #include <chrono>
21
+#include <ctime>
21
 #include <memory>
22
 #include <memory>
22
 
23
 
23
 #include <iostream>
24
 #include <iostream>
82
             // Alternative formulation
83
             // Alternative formulation
83
             std::time_t now = std::chrono::system_clock::to_time_t( std::chrono::system_clock::now() );
84
             std::time_t now = std::chrono::system_clock::to_time_t( std::chrono::system_clock::now() );
84
             std::stringstream out;
85
             std::stringstream out;
86
+
85
             // use locale format
87
             // use locale format
86
             //out.imbue(std::locale("")); // use whatever is on the system
88
             //out.imbue(std::locale("")); // use whatever is on the system
87
             //out << std::put_time(std::localtime(& now), L"%c") ; // locale on system
89
             //out << std::put_time(std::localtime(& now), L"%c") ; // locale on system
88
             // ISO-8601 format;
90
             // ISO-8601 format;
89
-            out << std::put_time(std::localtime(& now), "%F %T %z");
90
-            node["Serialized"] = out.str();
91
-
91
+            //out << std::put_time(std::localtime(& now), "%F %T %z");
92
+            
93
+	    // Use thread safe variant to suppress MSVC warning
94
+	    struct tm timeinfo;
95
+	    localtime_s(&timeinfo, &now);
96
+	    // ISO-8601 format;
97
+            out << std::put_time(&timeinfo, "%F %T %z");
98
+
99
+	    node["Serialized"] = out.str();
92
             node["Lemma_VERSION"] = LEMMA_VERSION;
100
             node["Lemma_VERSION"] = LEMMA_VERSION;
93
             return node;
101
             return node;
94
         };
102
         };

Loading…
Cancel
Save