Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unix epoch timestamp display option; copy-able field #4866

Closed
genemerewether opened this issue Jan 18, 2024 · 3 comments · Fixed by #5450
Closed

Unix epoch timestamp display option; copy-able field #4866

genemerewether opened this issue Jan 18, 2024 · 3 comments · Fixed by #5450
Labels
😤 annoying Something in the UI / SDK is annoying to use good first issue Good for newcomers 🏎️ Quick Issue Can be fixed in a few hours or less 📺 re_viewer affects re_viewer itself

Comments

@genemerewether
Copy link

Similar to #1714 - would it be possible to have a "unix epoch" timestamp display option? Sometimes external tools or code UIs use unix epoch seconds.

Also, is it possible to make the text there copy-able? Stretch-goal - make it a paste target that jumps the time to the pasted value.

E.g. 11677118942.733373 here on the timestamp panel:

Screenshot 2024-01-18 at 11 56 01
@genemerewether genemerewether added 👀 needs triage This issue needs to be triaged by the Rerun team 😤 annoying Something in the UI / SDK is annoying to use labels Jan 18, 2024
@Wumpf Wumpf added good first issue Good for newcomers 📺 re_viewer affects re_viewer itself and removed 👀 needs triage This issue needs to be triaged by the Rerun team labels Jan 18, 2024
@emilk
Copy link
Member

emilk commented Jan 19, 2024

Sounds good! The easiest way to implement this would be to add a UnixEpoch as another variant in enum TimeZone.

Selectable labels (all labels) will come in the next major release of Rerun. Making it editable is a nice idea though.

@emilk emilk added the 🏎️ Quick Issue Can be fixed in a few hours or less label Jan 19, 2024
@MacOS
Copy link

MacOS commented Mar 4, 2024

Is someone working on that?

@Wumpf
Copy link
Member

Wumpf commented Mar 4, 2024

@MacOS, no not right now, if you want to take a stab at it just go ahead! :)

emilk added a commit that referenced this issue Mar 14, 2024
* Closes #4866

### What
Added a unix epoch timestamp display option, as mentioned in issue
[4866](#4866)

<img width="1470" alt="Screenshot 2024-03-10 at 23 25 16-min"
src="https://github.com/rerun-io/rerun/assets/21971561/c18ae1c1-9eb5-494a-bf30-78d2e0f7f363">

Not quite sure how compact time display should be handled: 

```diff
    /// Useful when showing dates/times on a timeline
    /// and you want it compact.
    ///
    /// Shows dates when zoomed out, shows times when zoomed in,
    /// shows relative millisecond when really zoomed in.
    pub fn format_time_compact(&self, time_zone_for_timestamps: TimeZone) -> String {
...
            if let Some(datetime) = self.to_datetime() {
                let is_whole_minute = ns % 60_000_000_000 == 0;
                let time_format = if self.is_exactly_midnight() {
                    "[year]-[month]-[day]"
                } else if is_whole_minute {
                    "[hour]:[minute]"
                } else {
-                    "[hour]:[minute]:[second]"
+                    Self::get_time_prefix(&time_zone_for_timestamps)
                };
                let parsed_format = time::format_description::parse(time_format).unwrap();

                return Self::time_string(datetime, &parsed_format, time_zone_for_timestamps);
            }
...
}
``` 

Should the `[hour]:[minute]` be changed as well when unix timestamp is
chosen?

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using newly built examples:
[app.rerun.io](https://app.rerun.io/pr/5450/index.html)
* Using examples from latest `main` build:
[app.rerun.io](https://app.rerun.io/pr/5450/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[app.rerun.io](https://app.rerun.io/pr/5450/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!

- [PR Build Summary](https://build.rerun.io/pr/5450)
- [Docs
preview](https://rerun.io/preview/7e0f542930b6d1279c55190e3f375f0dcf2b2603/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/7e0f542930b6d1279c55190e3f375f0dcf2b2603/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

---------

Co-authored-by: mm <murgeljm@gmail.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
😤 annoying Something in the UI / SDK is annoying to use good first issue Good for newcomers 🏎️ Quick Issue Can be fixed in a few hours or less 📺 re_viewer affects re_viewer itself
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants