Skip to content

Commit e2bd4a9

Browse files
src/common/file_progress.hcpp: removing the format_duration which was added by accident
1 parent 35f3d8b commit e2bd4a9

2 files changed

Lines changed: 0 additions & 29 deletions

File tree

src/common/file_progress.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,14 @@
1313

1414
#include "file_progress.hpp"
1515

16-
#include <chrono>
17-
#include <cmath>
18-
#include <cstdint>
1916
#include <filesystem>
2017
#include <iomanip>
2118
#include <iostream>
2219
#include <limits>
23-
#include <sstream>
2420
#include <string>
2521

2622
// NOLINTBEGIN(*-narrowing-conversions)
2723

28-
[[nodiscard]] std::string
29-
format_duration(const std::chrono::duration<double> elapsed) {
30-
static constexpr auto s_per_h = 3600;
31-
static constexpr auto s_per_m = 60;
32-
const double tot_s = elapsed.count();
33-
34-
// break down into hours, minutes, seconds
35-
const std::uint32_t hours = tot_s / 3600;
36-
const std::uint32_t minutes = (static_cast<int>(tot_s) % s_per_h) / s_per_m;
37-
const double seconds = tot_s - (hours * s_per_h) - (minutes * s_per_m);
38-
39-
std::ostringstream oss;
40-
// NOLINTBEGIN(*-avoid-magic-numbers)
41-
oss << std::setfill('0') << std::setw(2) << hours << ":" << std::setfill('0')
42-
<< std::setw(2) << minutes << ":" << std::fixed << std::setprecision(2)
43-
<< std::setw(5) << seconds;
44-
// NOLINTEND(*-avoid-magic-numbers)
45-
return oss.str();
46-
}
47-
4824
file_progress::file_progress(const std::string &filename) :
4925
one_thousand_over_filesize{
5026
static_cast<double>(one_thousand) /

src/common/file_progress.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,10 @@
1616
#ifndef SRC_COMMON_FILE_PROGRESS_HPP_
1717
#define SRC_COMMON_FILE_PROGRESS_HPP_
1818

19-
#include <chrono>
2019
#include <cstddef>
21-
#include <cstdint>
2220
#include <fstream>
2321
#include <string>
2422

25-
[[nodiscard]] std::string
26-
format_duration(const std::chrono::duration<double> elapsed);
27-
2823
struct file_progress {
2924
static constexpr auto one_thousand{1000ul};
3025
double one_thousand_over_filesize{};

0 commit comments

Comments
 (0)