Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
05-24-2007, 01:39 AM
|
#1
|
Member
Registered: Jun 2006
Location: Macclesfield Canal, East Cheshire
Distribution: Salix-14.1
Posts: 129
Rep:
|
xclock
I would be very interested to know if it is possible to configure xclock to bring up say 3 or 4 different displays simultaneously each with a different time zone.
So it can say for instance London Mon15:30
- New York Mon06:30
- Sydney Mon15:30
Is there a simple answer to this?
phil
|
|
|
05-24-2007, 03:37 AM
|
#2
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Hi,
This is possible (at least on a solaris box...).
xclock -> starts a clock with the current (local) time,
`TZ=GMT ; xclock` => starts xclock showing GMT time.
Like I stated, I tried this on a solaris box (I'm at work, no linux box around). I do assume that linux doesn't use/set the TZ variable, but something simular must be possible. I'll give it another look when I'm back home and come back with the results.
|
|
|
05-24-2007, 10:35 AM
|
#3
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Hi,
On my linux box, TZ is not set, but I can use it to manipulate the xclock setting:
(export TZ=America/Sao_Paulo ; xclock)
Using the GMT / PDT / etc setting don't seem to work correctly on linux, you should use the timezone notation as shown by the tzset command.
Hope this helps.
|
|
|
05-24-2007, 11:45 AM
|
#4
|
Member
Registered: Aug 2005
Location: Guadalajara, Jal, Mexico
Distribution: Slackware Linux
Posts: 211
Rep:
|
Quote:
Originally Posted by druuna
Using the GMT / PDT / etc setting don't seem to work correctly on linux, you should use the timezone notation as shown by the tzset command.
|
If you want to use GMT you have to use it like
Code:
$ TZ=":GMT" xclock &
If you want to use GMT[+-][0..12] format try it like
Code:
$ TZ=":Etc/GMT+1" xclock &
$ #Or
$ TZ=":Etc/GMT-9" xclock &
If you want a specific city try
Code:
$ TZ=":Continent-or-region/City_(or_neighbour_city)_Name" xclock &
$ # For example:
$ TZ=":America/New_York" xclock &
$ TZ=":Australia/Sydney" xclock &
For more info see
man 3 tzset
and for the exact region/city availables see
ls /usr/share/zoneinfo.
Last edited by theoffset; 05-24-2007 at 11:48 AM.
|
|
|
05-24-2007, 11:54 AM
|
#5
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Hi,
I should learn to read more carefully, the :[filespec] notation is indeed in the manpage and I completely overlooked it. Just tried the :PDT notation and it works beautifully.
@theoffset: Thanks for the info/correction!
|
|
|
05-24-2007, 01:42 PM
|
#6
|
Member
Registered: Jun 2006
Location: Macclesfield Canal, East Cheshire
Distribution: Salix-14.1
Posts: 129
Original Poster
Rep:
|
xclock
Thanks guys.
I tried all these things and they work A ok!
What I need to know now is: how to start 3 clocks at the same time and keep them alive as a permanent desktop application or on a tool bar.
Can one construct an application that can be run on demand with the 3 clocks in a single window perhaps?
Phil
|
|
|
05-24-2007, 01:53 PM
|
#7
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Hi,
You could create a small bash script, something like this:
Quote:
#!/bin/bash
(export TZ=America/Sao_Paulo ; xclock) &
(export TZ=Europe/Amsterdam ; xclock) &
(export TZ=Asia/Tokyo ; xclock) &
|
If you want to manipulate the positioning, xclock can use the -geometry +x+y notation. For example: xclock -geometry +0+0 will place your clock in the upper left counter.
Hope this helps
|
|
|
05-24-2007, 02:28 PM
|
#8
|
Member
Registered: Jun 2006
Location: Macclesfield Canal, East Cheshire
Distribution: Salix-14.1
Posts: 129
Original Poster
Rep:
|
xclock
It helps a good deal.
It works, yes.
I tried to substitute xclock with
<xclock -d -strftime %A-%H:%M-%Z -geometry 200x30>
in order to make it a digital clock inside a small box along with the weekday and timezone name. O dear then it complains
"syntax error near unexpected token `-d'"
Does this mean that the command is getting too long and too complicated?
Phil.
|
|
|
05-24-2007, 02:35 PM
|
#9
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Hi,
If I try your code (xclock -d -strftime %A-%H:%M-%Z -geometry 200x30) on my box, it works nicely. I do assume that the < and > are _not_ part of your code.
|
|
|
05-24-2007, 04:45 PM
|
#10
|
Senior Member
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247
Rep:
|
Also works for me.
|
|
|
05-25-2007, 12:14 PM
|
#11
|
Member
Registered: Jun 2006
Location: Macclesfield Canal, East Cheshire
Distribution: Salix-14.1
Posts: 129
Original Poster
Rep:
|
xclock
yes. Works absolutely 100 % fine. Thanks for all the pointers.
Its all part of a learning curve, so the next step I see is - How does one make this so that it can be evoked from a menu item called worldclock or something like that.
Phil
|
|
|
05-25-2007, 12:56 PM
|
#12
|
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928
|
Just paste the contents of the above script into a new text document named worldclock.
Then make it executable: 'chmod 755 worldclock'
Then place a copy in /usr/local/bin and type 'worldclock' or place the command in your xintrc file(may need to background it: 'worldclock &').
|
|
|
05-25-2007, 02:50 PM
|
#13
|
Member
Registered: Jun 2006
Location: Macclesfield Canal, East Cheshire
Distribution: Salix-14.1
Posts: 129
Original Poster
Rep:
|
xclock
Yeah that works perfectly and Ive learned quite a bit via this exercise. Now I don know if this is pushing it a bit but how would one then put all these three clock displays into one window so they dont open as three different little windows but as three features in one window?
phil.
|
|
|
05-25-2007, 03:24 PM
|
#14
|
Senior Member
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467
Rep: 
|
rewrite the program. On the other hand there is a clock that does what you need, but I don't remember the name of it now. Maybe searching sourceforge for 'linux clock' might find it.
|
|
|
05-26-2007, 01:50 AM
|
#15
|
Member
Registered: Jun 2006
Location: Macclesfield Canal, East Cheshire
Distribution: Salix-14.1
Posts: 129
Original Poster
Rep:
|
xclock
Yes I have searched sourceforge extensively. But on the other hand It would be good to learn to do this myself. Maybe there is some reading matter on a website that can read and follow this up.
phil
|
|
|
All times are GMT -5. The time now is 11:13 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|