╭ changed ──╮ │src/try.zig│ ╰───────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │32 }); │ │33 defer threaded.deinit(); │ │34 const io = threaded.io(); │ │35 + const now: u64 = @intCast(std.Io.Timestamp.now(io, .real).toSeconds());│ │36 │ │37 const temp_dir_name = "temp-try"; │ │38 │ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │220 for (user_data, 0..) |u, i| { │ │221 events_to_consume[i] = .{ │ │222 .id = std.fmt.bytesToHex(user_ids[i], .lower), │ │222 - // stepped timestamps give the seeds a stable creation order │ │223 - .timestamp = @intCast(i + 1), │ │223 + // spread the accounts over the months before the repo activity │ │224 + .timestamp = seedTimestamp(now, i, user_data.len, 120 * std.time.s_per_day, 100 * std.time.s_per_day),│ │225 .author = .{ .name = "admin", .email = "admin@example.test" }, │ │226 .event = .{ │ │227 .user = .{ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │245 const author: evt.CommitAuthor = .{ .name = user_data[r.user_index].name, .email = user_data[r.user_index].email };│ │246 repo_events[i] = .{ │ │247 .id = std.fmt.bytesToHex(repo_event_ids[i], .lower), │ │247 - .timestamp = @intCast(user_data.len + i + 1), │ │248 + .timestamp = seedTimestamp(now, i, repo_data.len, 90 * std.time.s_per_day, 70 * std.time.s_per_day), │ │249 .author = author, │ │250 .event = .{ │ │251 .repo = .{ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │261 }; │ │262 grant_events[i] = .{ │ │263 .id = std.fmt.bytesToHex(evt.Grant.idOf(&repo_event_ids[i], &admin_user_id), .lower), │ │263 - .timestamp = @intCast(user_data.len + i + 1), │ │264 + .timestamp = seedTimestamp(now, i, repo_data.len, 90 * std.time.s_per_day, 70 * std.time.s_per_day), │ │265 .author = author, │ │266 .event = .{ .grant = .{ .target_id = &repo_event_ids[i], .user_id = &admin_user_id, .role = .owner } },│ │267 }; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │382 } │ │383 │ │384 try template_repo.add(io, allocator, &.{ "README.md", "docs/dev/contribute.md" }); │ │384 - _ = try template_repo.commit(io, allocator, .{ .message = "let there be light" }); │ │385 + _ = try template_repo.commit(io, allocator, .{ .message = "let there be light", .timestamp = now - 61 * std.time.s_per_day });│ │386 │ │387 // tag every commit in creation order, three versions at a time │ │388 var tag_num: usize = 1; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │392 // paginate through. each rewrites a few files with scattered line │ │393 // edits, so every commit is a multi-file diff with several separate │ │394 // hunks to look at. stepped timestamps vary the date column. │ │394 - const base_ts: u64 = 1_700_000_000; // 2023-11-14 │ │395 + const base_ts = now - 60 * std.time.s_per_day; │ │396 const edit_files = [_][]const u8{ "src/alpha.txt", "src/beta.txt", "src/gamma.txt" };│ │397 // commit subjects, cycled then padded to a varying length. │ │398 const subjects = [_][]const u8{ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │643 issue.description; │ │644 issue_events[i] = .{ │ │645 .id = std.fmt.bytesToHex(evt.EventWithId.randomId(prng.random()), .lower), │ │645 - // stepped timestamps so the issues list in a stable order │ │646 - .timestamp = @intCast(i + 1), │ │646 + // threads span several weeks, with time for replies on the newest one │ │647 + .timestamp = seedTimestamp(now, i, issue_data.len, 25 * std.time.s_per_day, 3 * std.time.s_per_hour), │ │648 .author = .{ .name = user_data[i % user_data.len].name, .email = user_data[i % user_data.len].email },│ │649 .event = .{ │ │650 .issue = .{ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ │676 │ │677 const ours = [_]evt.EventWithId{ .{ │ │678 .id = issue_events[issue_data.len - 4].id, │ │678 - .timestamp = 100, │ │679 + .timestamp = now - 120 * std.time.s_per_min, │ │680 .author = .{ .name = user_data[1].name, .email = user_data[1].email }, │ │681 .event = .{ .issue = .{ │ │682 .title = "Crash when resizing the window during the splash animation",│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────╮ │685 } }, │ │686 }, .{ │ │687 .id = issue_events[issue_data.len - 3].id, │ │687 - .timestamp = 101, │ │688 + .timestamp = now - 115 * std.time.s_per_min, │ │689 .author = .{ .name = user_data[1].name, .email = user_data[1].email },│ │690 .event = .{ .issue = .{ │ │691 .title = sync_issue.title, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────╮ │695 } }, │ │696 }, .{ │ │697 .id = issue_events[issue_data.len - 2].id, │ │697 - .timestamp = 102, │ │698 + .timestamp = now - 110 * std.time.s_per_min, │ │699 .author = .{ .name = user_data[1].name, .email = user_data[1].email },│ │700 .event = .{ .issue = .{ │ │701 .title = desc_issue.title, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯