Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1068)

Unified Diff: pkg/barback/lib/src/utils.dart

Issue 367023003: Roll forward revision 37912. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/barback/lib/src/graph/transform_node.dart ('k') | pkg/barback/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/barback/lib/src/utils.dart
diff --git a/pkg/barback/lib/src/utils.dart b/pkg/barback/lib/src/utils.dart
index c26c7e8f0cbebd1f4117627d9bb8d3553f1900d5..7ce6724e17c31d67239f2754e61c1757c2532b1e 100644
--- a/pkg/barback/lib/src/utils.dart
+++ b/pkg/barback/lib/src/utils.dart
@@ -336,3 +336,12 @@ final _exceptionPrefix = new RegExp(r'^([A-Z][a-zA-Z]*)?(Exception|Error): ');
/// [toString], so we remove that if it exists.
String getErrorMessage(error) =>
error.toString().replaceFirst(_exceptionPrefix, '');
+
+/// Returns a human-friendly representation of [duration].
+String niceDuration(Duration duration) {
+ var result = duration.inMinutes > 0 ? "${duration.inMinutes}:" : "";
+
+ var s = duration.inSeconds % 59;
+ var ms = (duration.inMilliseconds % 1000) ~/ 100;
+ return result + "$s.${ms}s";
+}
« no previous file with comments | « pkg/barback/lib/src/graph/transform_node.dart ('k') | pkg/barback/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698