Skip to content

Commit acd8b32

Browse files
committed
wip: update DateTimeProvider
1 parent c1e80ff commit acd8b32

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

Diff for: lib/src/sdk/platforms/web/time_providers/web_time_provider.dart

+3
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,7 @@ class WebTimeProvider implements TimeProvider {
5151
/// for more information.
5252
@override
5353
Int64 get now => fromDOMHighResTimeStamp(window.performance.now());
54+
55+
@override
56+
double get nowNanoseconds => window.performance.now();
5457
}

Diff for: lib/src/sdk/time_providers/datetime_time_provider.dart

+3
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ import 'time_provider.dart';
88
class DateTimeTimeProvider implements TimeProvider {
99
@override
1010
Int64 get now => Int64(DateTime.now().microsecondsSinceEpoch) * 1000;
11+
12+
@override
13+
double get nowNanoseconds => DateTime.now().microsecondsSinceEpoch * 1000.0;
1114
}

Diff for: lib/src/sdk/time_providers/time_provider.dart

+3
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,8 @@ abstract class TimeProvider {
1515
static const int nanosecondsPerMillisecond = 1000000;
1616

1717
/// The current time, in nanoseconds since Unix Epoch.
18+
@Deprecated('This getter will be removed in future without replacement.')
1819
Int64 get now;
20+
21+
double get nowNanoseconds;
1922
}

0 commit comments

Comments
 (0)