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

Add a widget to display the timestamp of a PV #3235

Closed
rosstitmarsh opened this issue Jan 15, 2025 · 7 comments
Closed

Add a widget to display the timestamp of a PV #3235

rosstitmarsh opened this issue Jan 15, 2025 · 7 comments

Comments

@rosstitmarsh
Copy link

Some users at ISIS have requested the ability to have the timestamp of a PV displayed on a Phoebus screen.

This could be useful to for screens displaying the latest data from the scan of an invasive diagnostic monitor. The user will imediately see date/time of the last scan without having to hover their mouse over an indicator or another work around.

Current ways to acheive this:

  • Reprogram the device to send out an extra string PV containing a human readable timestamp. This adds development overhead, is inflexible and means the timestamp format is fixed.
  • Use a script to read in pva://example:pv/timeStamp/secondsPastEpoch, format it, then write it to a loc:// PV. This adds the overhead of creating and running scripts and adds complexity.

A native widget would be much simpler for users and creators of displays. It would also make it possible to add a preference for the timestamp format in the Phoebus preferences making all timestamps consistent and more readable.

@kasemir
Copy link
Collaborator

kasemir commented Jan 15, 2025

@shroffk How about a formula function to support for example

  =timestamp(`SomePVName`)

It would turn the timestamp of a VType into a string like 2025-01-18 13:14:15.123456789

It could support an optional second formatting parameter:

  =timestamp(`SomePVName`, "YYYY-MM-DD HH:MM")

Ideally, the formatting uses some new syntax that's different from anything anybody has ever seen before.
Or be boring and go with the EPICS strftime, https://epics.anl.gov/base/R7-0/7-docs/doxygen/classepics_time.html#ac5223634796ca115443eb3a86c9c7ae3, which is like the common strftime with an addition to handle nanoseconds.

@kasemir
Copy link
Collaborator

kasemir commented Jan 15, 2025

The boring option would have the advantage of expanding the EPICS user base from just the cool kids to the general nerd population.

@shroffk
Copy link
Member

shroffk commented Jan 15, 2025

=timestamp(...)
This would be easy to implement.

Ideally, the formatting uses some new syntax that's different from anything anybody has ever seen before.

lol...This is depressingly funny.

However, we have two options... do we use the formatters used in Phoebus.
https://github.com/ControlSystemStudio/phoebus/blob/master/core/util/src/main/java/org/phoebus/util/time/TimestampFormats.java

or

strftime

I am leaning towards just using the Phoebus ones since the are used in other formulas too... like the archiver datasource ( aa:// )

@kasemir
Copy link
Collaborator

kasemir commented Jan 15, 2025

two options

Sadly, Googlefight is nothing more than a wikipedia entry, https://en.wikipedia.org/wiki/Googlefight

Still, my gut feeling suggests that python is more popular than EPICS, so that would certainly find a larger audience. I don't mean to say that the popular vote is necessarily the best, but going with the masses it is obviously an easy choice.

@kasemir
Copy link
Collaborator

kasemir commented Jan 15, 2025

.. and python has strftime

But yes, the TImestmapFormats are nice as well.

shroffk added a commit that referenced this issue Jan 16, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@shroffk
Copy link
Member

shroffk commented Jan 16, 2025

#3239

Currently, you can give any format that DateTimeFormatter accepts

shroffk added a commit that referenced this issue Jan 17, 2025
Issue #3235 a formula to extract and format timestamp from pv values
@kasemir
Copy link
Collaborator

kasemir commented Jan 31, 2025

Handled by #3239, using Text Update widget with

 =timestamp(`NameOfPV`)

@kasemir kasemir closed this as completed Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants