OLD | NEW |
1 part of dart.core; | 1 part of dart.core; |
2 class Duration implements Comparable<Duration> {static const int MICROSECONDS_P
ER_MILLISECOND = 1000; | 2 class Duration implements Comparable<Duration> {static const int MICROSECONDS_P
ER_MILLISECOND = 1000; |
3 static const int MILLISECONDS_PER_SECOND = 1000; | 3 static const int MILLISECONDS_PER_SECOND = 1000; |
4 static const int SECONDS_PER_MINUTE = 60; | 4 static const int SECONDS_PER_MINUTE = 60; |
5 static const int MINUTES_PER_HOUR = 60; | 5 static const int MINUTES_PER_HOUR = 60; |
6 static const int HOURS_PER_DAY = 24; | 6 static const int HOURS_PER_DAY = 24; |
7 static const int MICROSECONDS_PER_SECOND = MICROSECONDS_PER_MILLISECOND * MILLI
SECONDS_PER_SECOND; | 7 static const int MICROSECONDS_PER_SECOND = MICROSECONDS_PER_MILLISECOND * MILLI
SECONDS_PER_SECOND; |
8 static const int MICROSECONDS_PER_MINUTE = MICROSECONDS_PER_SECOND * SECONDS_PE
R_MINUTE; | 8 static const int MICROSECONDS_PER_MINUTE = MICROSECONDS_PER_SECOND * SECONDS_PE
R_MINUTE; |
9 static const int MICROSECONDS_PER_HOUR = MICROSECONDS_PER_MINUTE * MINUTES_PER_
HOUR; | 9 static const int MICROSECONDS_PER_HOUR = MICROSECONDS_PER_MINUTE * MINUTES_PER_
HOUR; |
10 static const int MICROSECONDS_PER_DAY = MICROSECONDS_PER_HOUR * HOURS_PER_DAY; | 10 static const int MICROSECONDS_PER_DAY = MICROSECONDS_PER_HOUR * HOURS_PER_DAY; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 if (n >= 10) return "0000$n"; | 58 if (n >= 10) return "0000$n"; |
59 return "00000$n"; | 59 return "00000$n"; |
60 } | 60 } |
61 String twoDigits(int n) { | 61 String twoDigits(int n) { |
62 if (n >= 10) return "$n"; | 62 if (n >= 10) return "$n"; |
63 return "0$n"; | 63 return "0$n"; |
64 } | 64 } |
65 if (inMicroseconds < 0) { | 65 if (inMicroseconds < 0) { |
66 return "-${-this}"; | 66 return "-${-this}"; |
67 } | 67 } |
68 String twoDigitMinutes = twoDigits(((__x0) => DEVC$RT.cast(__x0, num, int, "C
astGeneral", """line 258, column 40 of dart:core/duration.dart: """, __x0 is int
, true))(inMinutes.remainder(MINUTES_PER_HOUR))); | 68 String twoDigitMinutes = twoDigits(((__x0) => DEVC$RT.cast(__x0, num, int, "I
mplicitCast", """line 258, column 40 of dart:core/duration.dart: """, __x0 is in
t, true))(inMinutes.remainder(MINUTES_PER_HOUR))); |
69 String twoDigitSeconds = twoDigits(((__x1) => DEVC$RT.cast(__x1, num, int, "C
astGeneral", """line 259, column 40 of dart:core/duration.dart: """, __x1 is int
, true))(inSeconds.remainder(SECONDS_PER_MINUTE))); | 69 String twoDigitSeconds = twoDigits(((__x1) => DEVC$RT.cast(__x1, num, int, "I
mplicitCast", """line 259, column 40 of dart:core/duration.dart: """, __x1 is in
t, true))(inSeconds.remainder(SECONDS_PER_MINUTE))); |
70 String sixDigitUs = sixDigits(((__x2) => DEVC$RT.cast(__x2, num, int, "CastGe
neral", """line 261, column 19 of dart:core/duration.dart: """, __x2 is int, tru
e))(inMicroseconds.remainder(MICROSECONDS_PER_SECOND))); | 70 String sixDigitUs = sixDigits(((__x2) => DEVC$RT.cast(__x2, num, int, "Implic
itCast", """line 261, column 19 of dart:core/duration.dart: """, __x2 is int, tr
ue))(inMicroseconds.remainder(MICROSECONDS_PER_SECOND))); |
71 return "$inHours:$twoDigitMinutes:$twoDigitSeconds.$sixDigitUs"; | 71 return "$inHours:$twoDigitMinutes:$twoDigitSeconds.$sixDigitUs"; |
72 } | 72 } |
73 bool get isNegative => _duration < 0; | 73 bool get isNegative => _duration < 0; |
74 Duration abs() => new Duration._microseconds(_duration.abs()); | 74 Duration abs() => new Duration._microseconds(_duration.abs()); |
75 Duration operator -() => new Duration._microseconds(-_duration); | 75 Duration operator -() => new Duration._microseconds(-_duration); |
76 } | 76 } |
OLD | NEW |