Browse Source

Use of rawtime_s instead of rawtime to suppress MSVC warning

add-code-of-conduct-1
John Daily 5 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,6 +170,7 @@ namespace Lemma {
170 170
     }; // -----  end of class  FHT  ----
171 171
 
172 172
     // Forward declarations
173
+/*
173 174
     template<>
174 175
     const Eigen::Matrix<Real, Eigen::Dynamic, 3>  FHT<FHTKEY201>::WT;
175 176
     template<>
@@ -184,6 +185,7 @@ namespace Lemma {
184 185
     const Eigen::Matrix<Real, Eigen::Dynamic, 3>  FHT<FHTKONG241>::WT;
185 186
     template<>
186 187
     const Eigen::Matrix<Real, Eigen::Dynamic, 3>  FHT<IRONS>::WT;
188
+*/
187 189
 
188 190
     template < HANKELTRANSFORMTYPE Type >
189 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,6 +18,7 @@
18 18
 #include "yaml-cpp/yaml.h"
19 19
 
20 20
 #include <chrono>
21
+#include <ctime>
21 22
 #include <memory>
22 23
 
23 24
 #include <iostream>
@@ -82,13 +83,20 @@ class LemmaObject {
82 83
             // Alternative formulation
83 84
             std::time_t now = std::chrono::system_clock::to_time_t( std::chrono::system_clock::now() );
84 85
             std::stringstream out;
86
+
85 87
             // use locale format
86 88
             //out.imbue(std::locale("")); // use whatever is on the system
87 89
             //out << std::put_time(std::localtime(& now), L"%c") ; // locale on system
88 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 100
             node["Lemma_VERSION"] = LEMMA_VERSION;
93 101
             return node;
94 102
         };

Loading…
Cancel
Save