aboutsummaryrefslogtreecommitdiffstats
path: root/util/stream/format.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /util/stream/format.cpp
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'util/stream/format.cpp')
-rw-r--r--util/stream/format.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/util/stream/format.cpp b/util/stream/format.cpp
index 3eabd45eb4..3996130df5 100644
--- a/util/stream/format.cpp
+++ b/util/stream/format.cpp
@@ -1,14 +1,14 @@
-#include "format.h"
-#include "output.h"
-
+#include "format.h"
+#include "output.h"
+
#include <util/generic/ymath.h>
-#include <util/string/cast.h>
-
+#include <util/string/cast.h>
+
namespace NFormatPrivate {
static inline i64 Round(double value) {
double res1 = floor(value);
double res2 = ceil(value);
- return (value - res1 < res2 - value) ? (i64)res1 : (i64)res2;
+ return (value - res1 < res2 - value) ? (i64)res1 : (i64)res2;
}
static inline IOutputStream& PrintDoubleShortly(IOutputStream& os, const double& d) {
@@ -34,9 +34,9 @@ namespace NFormatPrivate {
return os << Prec(d, mode, ndigits);
}
-}
+}
-template <>
+template <>
void Out<NFormatPrivate::THumanReadableSize>(IOutputStream& stream, const NFormatPrivate::THumanReadableSize& value) {
ui64 base = value.Format == SF_BYTES ? 1024 : 1000;
ui64 base2 = base * base;
@@ -70,7 +70,7 @@ void Out<NFormatPrivate::THumanReadableSize>(IOutputStream& stream, const NForma
}
}
-template <>
+template <>
void Out<NFormatPrivate::THumanReadableDuration>(IOutputStream& os, const NFormatPrivate::THumanReadableDuration& hr) {
TTempBuf buf;
TMemoryOutput ss(buf.Data(), buf.Size());
@@ -82,11 +82,11 @@ void Out<NFormatPrivate::THumanReadableDuration>(IOutputStream& os, const NForma
break;
}
if (microSeconds < 1000 * 1000) {
- NFormatPrivate::PrintDoubleShortly(ss, (double)microSeconds / 1000.0) << "ms";
+ NFormatPrivate::PrintDoubleShortly(ss, (double)microSeconds / 1000.0) << "ms";
break;
}
- double seconds = (double)(hr.Value.MilliSeconds()) / 1000.0;
+ double seconds = (double)(hr.Value.MilliSeconds()) / 1000.0;
if (seconds < 60) {
NFormatPrivate::PrintDoubleShortly(ss, seconds) << 's';
break;
@@ -109,9 +109,9 @@ void Out<NFormatPrivate::THumanReadableDuration>(IOutputStream& os, const NForma
for (size_t i = 0; i < Y_ARRAY_SIZE(times); ++i) {
if (times[i] > 0) {
- if (!first) {
+ if (!first) {
ss << ' ';
- }
+ }
ss << times[i] << names[i];
first = false;
}
@@ -123,12 +123,12 @@ void Out<NFormatPrivate::THumanReadableDuration>(IOutputStream& os, const NForma
}
void Time(IOutputStream& l) {
- l << millisec();
-}
-
+ l << millisec();
+}
+
void TimeHumanReadable(IOutputStream& l) {
- char timeStr[30];
+ char timeStr[30];
const time_t t = time(nullptr);
-
- l << ctime_r(&t, timeStr);
+
+ l << ctime_r(&t, timeStr);
}