Skip to content

Commit 04c3463

Browse files
authored
Merge pull request #27 from FAIRDataPipeline/gcc-header-fix
use strftime instead of put_time for compatability
2 parents 25ce127 + a19d7b2 commit 04c3463

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/objects/metadata.cxx

+5-6
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,16 @@ std::string generate_random_hash() {
5151

5252
std::string current_time_stamp(bool file_name) {
5353
auto t_ = std::time(nullptr);
54-
auto tm_ = *std::localtime(&t_);
55-
56-
std::ostringstream oss_;
54+
auto tm_ = std::localtime(&t_);
55+
char buffer_[80];
5756

5857
if (!file_name) {
59-
oss_ << std::put_time(&tm_, "%Y-%m-%d %H:%M:%S");
58+
strftime(buffer_, sizeof(buffer_), "%Y-%m-%d %H:%M:%S", tm_);
6059
} else {
61-
oss_ << std::put_time(&tm_, "%Y%m%d-%H%M%S");
60+
strftime(buffer_, sizeof(buffer_), "%Y%m%d-%H%M%S", tm_);
6261
}
6362

64-
return oss_.str();
63+
return std::string(buffer_);
6564
}
6665

6766
std::string remove_local_from_root(const std::string &root){

0 commit comments

Comments
 (0)