Skip to content

Commit f054e65

Browse files
committed
IOSS: See if this fixes ubuntu spack build
1 parent 7557291 commit f054e65

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,17 @@ std::ostream &Ioss::Utils::get_debug_stream() { return *m_debugStream; }
158158

159159
void Ioss::Utils::time_and_date(char *time_string, char *date_string, size_t length)
160160
{
161+
#if FMT_VERSION < 110000
162+
std::time_t t = std::time(nullptr);
163+
std::string time = fmt::format("{:%H:%M:%S}", *std::localtime(&t));
164+
std::string date;
165+
if (length >= 10) {
166+
date = fmt::format("{:%Y/%m/%d}", *std::localtime(&t));
167+
}
168+
else {
169+
date = fmt::format("{:%y/%m/%d}", *std::localtime(&t));
170+
}
171+
#else
161172
auto now = std::chrono::system_clock::now();
162173
std::string time = fmt::format("{:%T}", std::chrono::time_point_cast<std::chrono::seconds>(now));
163174
std::string date;
@@ -167,6 +178,7 @@ void Ioss::Utils::time_and_date(char *time_string, char *date_string, size_t len
167178
else {
168179
date = fmt::format("{:%y/%m/%d}", now);
169180
}
181+
#endif
170182
copy_string(time_string, time, 9);
171183
copy_string(date_string, date, length + 1);
172184
}

0 commit comments

Comments
 (0)