Skip to content

Commit 324c9e0

Browse files
committed
IOSS: Update fmt library; use std::localtime instead of fmt::localtime
1 parent bace0f5 commit 324c9e0

File tree

7 files changed

+16
-32
lines changed

7 files changed

+16
-32
lines changed

install-tpl.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ if [ "$FMT" == "YES" ]
773773
then
774774
if [ "$FORCE" == "YES" ] || [ "$FORCE_FMT" == "YES" ] || ! [ -e $INSTALL_PATH/include/fmt/core.h ]
775775
then
776-
fmt_version="11.1.4"
776+
fmt_version="11.2.0"
777777
echo "${txtgrn}+++ FMT ${fmt_version} ${txtrst}"
778778
cd $ACCESS || exit
779779
cd TPL/fmt || exit

packages/seacas/applications/conjoin/Conjoin.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -954,10 +954,10 @@ namespace {
954954

955955
std::time_t date_time = std::time(nullptr);
956956

957-
auto date = fmt::format("{:%Y/%m/%d}", fmt::localtime(date_time));
957+
auto date = fmt::format("{:%Y/%m/%d}", *std::localtime(&date_time));
958958
copy_string(qaRecord[num_qa_records].qa_record[0][2], date.c_str(), MAX_STR_LENGTH + 1);
959959

960-
auto time = fmt::format("{:%T}", fmt::localtime(date_time));
960+
auto time = fmt::format("{:%T}", *std::localtime(&date_time));
961961
copy_string(qaRecord[num_qa_records].qa_record[0][3], time.c_str(), MAX_STR_LENGTH + 1);
962962

963963
error += ex_put_qa(id_out, num_qa_records + 1, qaRecord[0].qa_record);

packages/seacas/applications/epu/epu.C

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,20 +1785,12 @@ namespace {
17851785
copy_string(qaRecord[num_qa_records].qa_record[0][1], qainfo[2], MAX_STR_LENGTH + 1); // Version
17861786

17871787
time_t date_time = std::time(nullptr);
1788-
#if defined __NVCC__
1789-
auto *lt = std::localtime(&date_time);
1790-
buffer = fmt::format("{:%Y/%m/%d}", *lt);
1791-
#else
1792-
auto const lt = fmt::localtime(date_time);
1793-
buffer = fmt::format("{:%Y/%m/%d}", lt);
1794-
#endif
1788+
auto const *lt = std::localtime(&date_time);
1789+
1790+
buffer = fmt::format("{:%Y/%m/%d}", *lt);
17951791
copy_string(qaRecord[num_qa_records].qa_record[0][2], buffer, MAX_STR_LENGTH + 1);
17961792

1797-
#if defined __NVCC__
17981793
buffer = fmt::format("{:%H:%M:%S}", *lt);
1799-
#else
1800-
buffer = fmt::format("{:%H:%M:%S}", lt);
1801-
#endif
18021794
copy_string(qaRecord[num_qa_records].qa_record[0][3], buffer, MAX_STR_LENGTH + 1);
18031795

18041796
error = ex_put_qa(id_out, num_qa_records + 1, qaRecord[0].qa_record);

packages/seacas/applications/exodiff/exodiff.C

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright(C) 1999-, 20242024, , , , , , , National Technology & Engineering Solutions
1+
// Copyright(C) 1999-2025 National Technology & Engineering Solutions
22
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
33
// NTESS, the U.S. Government retains certain rights in this software.
44
//
@@ -60,15 +60,7 @@ struct TimeInterp
6060
std::string Date()
6161
{
6262
time_t calendar_time = time(nullptr);
63-
#if defined __NVCC__
64-
char tbuf[32];
65-
struct tm *local_time = localtime(&calendar_time);
66-
strftime(tbuf, 32, "%Y/%m/%d %H:%M:%S %Z", local_time);
67-
std::string time_string(tbuf);
68-
#else
69-
auto const local_time = fmt::localtime(calendar_time);
70-
auto time_string = fmt::format("{:%Y/%m/%d %H:%M:%S %Z}", local_time);
71-
#endif
63+
auto time_string = fmt::format("{:%Y/%m/%d %H:%M:%S %Z}", *std::localtime(&calendar_time));
7264
return time_string;
7365
}
7466

packages/seacas/libraries/ioss/src/Ioss_Utils.C

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright(C) 1999-2024 National Technology & Engineering Solutions
1+
// Copyright(C) 1999-2025 National Technology & Engineering Solutions
22
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
33
// NTESS, the U.S. Government retains certain rights in this software.
44
//
@@ -161,13 +161,13 @@ std::ostream &Ioss::Utils::get_debug_stream() { return *m_debugStream; }
161161
void Ioss::Utils::time_and_date(char *time_string, char *date_string, size_t length)
162162
{
163163
std::time_t t = std::time(nullptr);
164-
std::string time = fmt::format("{:%H:%M:%S}", fmt::localtime(t));
164+
std::string time = fmt::format("{:%H:%M:%S}", *std::localtime(&t));
165165
std::string date;
166166
if (length >= 10) {
167-
date = fmt::format("{:%Y/%m/%d}", fmt::localtime(t));
167+
date = fmt::format("{:%Y/%m/%d}", *std::localtime(&t));
168168
}
169169
else {
170-
date = fmt::format("{:%y/%m/%d}", fmt::localtime(t));
170+
date = fmt::format("{:%y/%m/%d}", *std::localtime(&t));
171171
}
172172
copy_string(time_string, time, 9);
173173
copy_string(date_string, date, length + 1);

packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,8 +1051,8 @@ size_t Iocgns::Utils::common_write_metadata(int file_ptr, const Ioss::Region &re
10511051

10521052
CGERR(cg_goto(file_ptr, base, "end"));
10531053
std::time_t t = std::time(nullptr);
1054-
std::string date = fmt::format("{:%Y/%m/%d}", fmt::localtime(t));
1055-
std::string time = fmt::format("{:%H:%M:%S}", fmt::localtime(t));
1054+
std::string date = fmt::format("{:%Y/%m/%d}", *std::localtime(&t));
1055+
std::string time = fmt::format("{:%H:%M:%S}", *std::localtime(&t));
10561056

10571057
std::string code_version = region.get_optional_property("code_version", "unknown");
10581058
std::string code_name = region.get_optional_property("code_name", "unknown");

packages/seacas/libraries/suplib_cpp/time_stamp.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright(C) 1999-2021, 2023 National Technology & Engineering Solutions
1+
// Copyright(C) 1999-2021, 2023, 2025 National Technology & Engineering Solutions
22
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
33
// NTESS, the U.S. Government retains certain rights in this software.
44
//
@@ -14,6 +14,6 @@ std::string time_stamp(const std::string &format)
1414
}
1515

1616
std::time_t t = std::time(nullptr);
17-
std::string time_string = fmt::format(fmt::runtime(format), fmt::localtime(t));
17+
std::string time_string = fmt::format(fmt::runtime(format), *std::localtime(&t));
1818
return time_string;
1919
}

0 commit comments

Comments
 (0)