aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/lib/strings/numbers.h
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2016-09-18 14:48:00 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-09-18 16:02:38 -0700
commit521caa5774d7be04e9682091a251d8bc8721008f (patch)
tree3896ee018f79cc7c0e00b7b99bc2e107ff116fcf /tensorflow/core/lib/strings/numbers.h
parent7767742e20b5480a5e95590a16254ab25566db99 (diff)
Add strings::HumanReadableNum to tensorflow/core/lib/strings/numbers.h
Move HumanReadableElapsedTime from tensorflow/core/lib/strings/str_util.h to tensorflow/core/lib/strings/numbers.h to match the other HumanReadable* routines. Change: 133533798
Diffstat (limited to 'tensorflow/core/lib/strings/numbers.h')
-rw-r--r--tensorflow/core/lib/strings/numbers.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/tensorflow/core/lib/strings/numbers.h b/tensorflow/core/lib/strings/numbers.h
index 2125bf884c..31b6abbac6 100644
--- a/tensorflow/core/lib/strings/numbers.h
+++ b/tensorflow/core/lib/strings/numbers.h
@@ -122,11 +122,24 @@ bool safe_strtof(const char* str, float* value);
// Values may be rounded on over- and underflow.
bool safe_strtod(const char* str, double* value);
+// Converts from an int64 to a human readable string representing the
+// same number, using decimal powers. e.g. 1200000 -> "1.20M".
+string HumanReadableNum(int64 value);
+
// Converts from an int64 representing a number of bytes to a
// human readable string representing the same number.
// e.g. 12345678 -> "11.77MiB".
string HumanReadableNumBytes(int64 num_bytes);
+// Converts a time interval as double to a human readable
+// string. For example:
+// 0.001 -> "1 ms"
+// 10.0 -> "10 s"
+// 933120.0 -> "10.8 days"
+// 39420000.0 -> "1.25 years"
+// -10 -> "-10 s"
+string HumanReadableElapsedTime(double seconds);
+
} // namespace strings
} // namespace tensorflow