Skip to content

Commit

Permalink
cleanup unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
danovaro committed Dec 9, 2024
1 parent 4660734 commit 963c295
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 33 deletions.
63 changes: 31 additions & 32 deletions src/metkit/mars/StepRange.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,25 @@ using namespace eckit;

namespace {

enum TimeUnit {
Second = 0,
Minute = 1,
Hour = 2,
Day = 3
};

TimeUnit maxUnit(const eckit::Time& t) {
if (t.seconds() == 0) {
if (t.minutes() == 0) {
if (t.hours() == 0) {
return TimeUnit::Day;
}
return TimeUnit::Hour;
}
return TimeUnit::Minute;
}
return TimeUnit::Second;
}
// enum TimeUnit {
// Second = 0,
// Minute = 1,
// Hour = 2,
// Day = 3
// };

// TimeUnit maxUnit(const eckit::Time& t) {
// if (t.seconds() == 0) {
// if (t.minutes() == 0) {
// if (t.hours() == 0) {
// return TimeUnit::Day;
// }
// return TimeUnit::Hour;
// }
// return TimeUnit::Minute;
// }
// return TimeUnit::Second;
// }

std::string canonical(const eckit::Time& time) {

Expand All @@ -65,24 +65,23 @@ std::string canonical(const eckit::Time& time) {
return out;
}

std::string canonical(const eckit::Time& time, TimeUnit unit) {
switch (unit) {
case TimeUnit::Second:
return std::to_string(time.seconds()+60*time.minutes()+3600*time.hours()) + "s";
case TimeUnit::Minute:
return std::to_string(time.minutes()+60*time.hours()) + "m";
case TimeUnit::Day:
case TimeUnit::Hour:
default:
return std::to_string(time.hours());
}
}
// std::string canonical(const eckit::Time& time, TimeUnit unit) {
// switch (unit) {
// case TimeUnit::Second:
// return std::to_string(time.seconds()+60*time.minutes()+3600*time.hours()) + "s";
// case TimeUnit::Minute:
// return std::to_string(time.minutes()+60*time.hours()) + "m";
// case TimeUnit::Day:
// case TimeUnit::Hour:
// default:
// return std::to_string(time.hours());
// }
// }

}

namespace metkit::mars {


//----------------------------------------------------------------------------------------------------------------------

StepRange::operator std::string() const
Expand Down
2 changes: 1 addition & 1 deletion src/tools/bufr-sanity-check.cc
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ void BufrCheck::process(const PathName& input, const PathName& output) {
numMessage++;
}
}
catch(eckit::Exception e) {
catch(eckit::Exception& e) {
Log::warning() << " Error parsing message " << numMessage << " - offset " << pos << std::endl;
if (verbose_) {
e.dumpStackTrace(Log::warning());
Expand Down

0 comments on commit 963c295

Please sign in to comment.