LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-24-2007, 12:39 AM   #1
autophil
Member
 
Registered: Jun 2006
Location: Macclesfield Canal, East Cheshire
Distribution: Salix-14.1
Posts: 129
Blog Entries: 1

Rep: Reputation: 15
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
 
Old 05-24-2007, 02:37 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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.
 
Old 05-24-2007, 09:35 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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.
 
Old 05-24-2007, 10:45 AM   #4
theoffset
Member
 
Registered: Aug 2005
Location: Guadalajara, Jal, Mexico
Distribution: Slackware Linux
Posts: 211

Rep: Reputation: 31
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 10:48 AM.
 
Old 05-24-2007, 10:54 AM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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!
 
Old 05-24-2007, 12:42 PM   #6
autophil
Member
 
Registered: Jun 2006
Location: Macclesfield Canal, East Cheshire
Distribution: Salix-14.1
Posts: 129

Original Poster
Blog Entries: 1

Rep: Reputation: 15
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
 
Old 05-24-2007, 12:53 PM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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
 
Old 05-24-2007, 01:28 PM   #8
autophil
Member
 
Registered: Jun 2006
Location: Macclesfield Canal, East Cheshire
Distribution: Salix-14.1
Posts: 129

Original Poster
Blog Entries: 1

Rep: Reputation: 15
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.
 
Old 05-24-2007, 01:35 PM   #9
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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.
 
Old 05-24-2007, 03:45 PM   #10
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
Also works for me.
 
Old 05-25-2007, 11:14 AM   #11
autophil
Member
 
Registered: Jun 2006
Location: Macclesfield Canal, East Cheshire
Distribution: Salix-14.1
Posts: 129

Original Poster
Blog Entries: 1

Rep: Reputation: 15
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
 
Old 05-25-2007, 11:56 AM   #12
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
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 &').
 
Old 05-25-2007, 01:50 PM   #13
autophil
Member
 
Registered: Jun 2006
Location: Macclesfield Canal, East Cheshire
Distribution: Salix-14.1
Posts: 129

Original Poster
Blog Entries: 1

Rep: Reputation: 15
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.
 
Old 05-25-2007, 02:24 PM   #14
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
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.
 
Old 05-26-2007, 12:50 AM   #15
autophil
Member
 
Registered: Jun 2006
Location: Macclesfield Canal, East Cheshire
Distribution: Salix-14.1
Posts: 129

Original Poster
Blog Entries: 1

Rep: Reputation: 15
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
xclock hands color cch2cch Linux - Newbie 2 05-04-2011 07:35 AM
xclock as desktop background? MasterOfTheWind Linux - Software 2 11-25-2006 02:02 PM
xclock not running mumtaz52 Linux - Enterprise 3 01-02-2006 12:11 AM
Anyway to get xclock to show just the date? Royle Linux - General 11 07-30-2005 11:17 AM
xclock colors csDraco_ Slackware 1 08-24-2003 03:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration