You are not logged in.

#1 2018-01-16 20:27:07

whale
Member
Registered: 2018-01-16
Posts: 3

[SOLVED] Displaying both local time and UTC time in xfce4 panel

I just scratch installed arch with xfce4, and changed the hardware clock to UTC with

hwclock --systohc

after setting the timezone with the xfce4 clock properties window. The panel clock now shows the correct local time when I set the proper timezone through the clock properties window.
clock_Screenshot2.png
The clock properties window has options for timezone and format, which I used

%a, %b %d %Y %r

to get something like "Tue, Jan 16 2018 03:24:16 PM" local time. Is there a way to get a string that includes the current UTC weekday and time, like "Tue, Jan 16 2018 03:24:16 PM, Tue 20:24 UTC"?

clock_Screenshot.png

Thanks

Last edited by whale (2018-01-16 21:09:08)

Offline

#2 2018-01-16 20:36:00

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Displaying both local time and UTC time in xfce4 panel

I'm not sure if that's possible, but check...

man date

No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2018-01-16 21:08:42

whale
Member
Registered: 2018-01-16
Posts: 3

Re: [SOLVED] Displaying both local time and UTC time in xfce4 panel

Thanks for the reply slithery, date -u gives UTC time. But that's not entirely helpful.

After some more digging, it looks like this is more of an xfce4 question rather than a date string question. (probably belongs on xfce4 forums) But I'll put out what I found so far.

It looks like xfce4 panel clock is actually a plugin.
The config file is ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml

In it is an entry for the clock plugin. It looks like the values set from the panel goes into here.

   <property name="plugin-5" type="string" value="clock">
      <property name="timezone" type="string" value="EST"/>
      <property name="mode" type="uint" value="2"/>
      <property name="show-military" type="bool" value="false"/>
      <property name="show-seconds" type="bool" value="true"/>
      <property name="flash-separators" type="bool" value="false"/>
      <property name="show-meridiem" type="bool" value="true"/>
      <property name="digital-format" type="string" value="%a, %b %d %Y %r"/>
    </property>

The plugin itself isn't anywhere I can find, but the (compiled?) .so file is located at /usr/lib/xfce4/panel/plugins and inside is libclock.so.

So the answer to my own questions is probably to find the source of the clock plugin, figure out if it uses the date command somewhere (it probably does?), edit it to my liking, and put it all back together again.

If anyone knows if the source files exist, please post away.
I'll mark this as solved for now...

Offline

#4 2018-01-16 21:22:02

toz
Member
Registered: 2011-10-28
Posts: 513

Re: [SOLVED] Displaying both local time and UTC time in xfce4 panel

As an option, you can use the genmon-plugin to display the date in that format on the panel. Use a command like:

bash -c 'echo "$(date  "+%a, %b %d %Y %r"), $(date -u "+%a %r") UTC"'

The clock applet also pops up a calendar when clicked, so if you need that functionality you can tie in a zenity or yad calendar dialog to the click event of the genmon plugin. More info here.

Offline

#5 2018-01-16 21:27:37

loqs
Member
Registered: 2014-03-06
Posts: 19,113

Re: [SOLVED] Displaying both local time and UTC time in xfce4 panel

whale wrote:

So the answer to my own questions is probably to find the source of the clock plugin, figure out if it uses the date command somewhere (it probably does?), edit it to my liking, and put it all back together again.

If anyone knows if the source files exist, please post away.

https://git.xfce.org/panel-plugins/xfce … time.c#n79

Offline

#6 2018-01-16 22:26:41

whale
Member
Registered: 2018-01-16
Posts: 3

Re: [SOLVED] Displaying both local time and UTC time in xfce4 panel

Thanks toz and loqs.
Customizing the panel is now on my list as a weekend project.
Putting just 10 extra characters into the clock turns out to require more work than I previously thought.

Offline

Board footer

Powered by FluxBB