From 6035698acba6401566149ba8213c3e4eb078e23e Mon Sep 17 00:00:00 2001 From: John McDole Date: Tue, 3 Sep 2024 12:10:18 -0700 Subject: [PATCH] Really make the seed stable to YYYY-MM-DD (#154568) `hashCode` is stable for the same inputs of `DateTime`; those inputs should be to the day only (oops). --- dev/devicelab/lib/tasks/microbenchmarks.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/devicelab/lib/tasks/microbenchmarks.dart b/dev/devicelab/lib/tasks/microbenchmarks.dart index 4d2cf67b68..e4f354a0d8 100644 --- a/dev/devicelab/lib/tasks/microbenchmarks.dart +++ b/dev/devicelab/lib/tasks/microbenchmarks.dart @@ -21,7 +21,8 @@ TaskFunction createMicrobenchmarkTask({ }) { // Generate a seed for this test stable around the date. - final int seed = DateTime.now().toUtc().subtract(const Duration(hours: 7)).hashCode; + final DateTime seedDate = DateTime.now().toUtc().subtract(const Duration(hours: 7)); + final int seed = DateTime(seedDate.year, seedDate.month, seedDate.day).hashCode; return () async { final Device device = await devices.workingDevice;