From 1a8886610d6a9662646ddb6c3541546dbe77f8df Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Thu, 26 Dec 2024 17:59:32 +0100 Subject: fix(pkgs/back): Sort the issues by descending date --- pkgs/by-name/ba/back/src/git_bug/format/mod.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'pkgs/by-name/ba/back/src/git_bug/format') diff --git a/pkgs/by-name/ba/back/src/git_bug/format/mod.rs b/pkgs/by-name/ba/back/src/git_bug/format/mod.rs index 4ebf6d4..b3b6bcc 100644 --- a/pkgs/by-name/ba/back/src/git_bug/format/mod.rs +++ b/pkgs/by-name/ba/back/src/git_bug/format/mod.rs @@ -61,6 +61,27 @@ impl Display for TimeStamp { } } +/// An UNIX time stamp. +/// +/// These should only ever be used for human-display, because timestamps are unreliably in a +/// distributed system. +/// +/// This one allows underlying access to it's value and is only obtainable via `unsafe` code. +/// The reason behind this is, that you might need to access this to improve the display for humans +/// (i.e., sorting by date). +#[derive(Debug, Default, Clone, Copy, Ord, PartialOrd, Eq, PartialEq)] +pub struct UnsafeTimeStamp { + value: u64, +} +impl TimeStamp { + /// # Safety + /// This is not really unsafe, but there is just no way your can trust a time stamp in a + /// distributed system. As such access to the raw value could lead to bugs. + pub unsafe fn to_unsafe(self) -> UnsafeTimeStamp { + UnsafeTimeStamp { value: self.value } + } +} + #[derive(Debug, Default, Deserialize, Clone, PartialEq, Eq)] /// A string that should be escaped when injected into html content. pub struct HtmlString { -- cgit 1.4.1