LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
issue_reports.cc
Go to the documentation of this file.
4 
5 #include <ctime>
6 #include <string>
7 
8 namespace {
9  std::string const st{"st"};
10  std::string const nd{"nd"};
11  std::string const rd{"rd"};
12  std::string const th{"th"};
13 
14  std::string const&
15  suffix(unsigned const count)
16  {
17  // *0, *4 - *9 use "th".
18  unsigned const lastDigit = count % 10;
19  if (lastDigit >= 4 || lastDigit == 0)
20  return th;
21  // *11, *12, or *13 use "th".
22  if (count % 100 - lastDigit == 10)
23  return th;
24  return (lastDigit == 1 ? st : (lastDigit == 2 ? nd : rd));
25  }
26 } // namespace
27 
28 void
29 art::detail::issue_reports(unsigned const count, EventID const& id)
30 {
31  time_t t = time(0);
32  constexpr char tsOutput[] = "dd-Mon-yyyy hh:mm:ss TZN ";
33  constexpr size_t tsmax = (sizeof tsOutput) + 1;
34  char ts[tsmax];
35  strftime(ts, tsmax, "%d-%b-%Y %H:%M:%S %Z", localtime(&t));
36  mf::LogVerbatim{"ArtReport"} << "Begin processing the " << count
37  << suffix(count) << " record. " << id << " at "
38  << ts;
39  // At some point we may want to initiate checkpointing here
40 }
void issue_reports(unsigned count, EventID const &id)