LinuxQuestions.org
Visit Jeremy's Blog.
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 07-09-2016, 12:33 AM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,555

Rep: Reputation: 177Reputation: 177
Need long description timezone


Is there a way to get the long description timezone in Slackware? For example "America/New_York", not just "EDT"
 
Old 07-09-2016, 01:46 AM   #2
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 915

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
Maybe
Code:
ls -l /etc/localtime-copied-from
 
Old 07-09-2016, 01:51 AM   #3
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 915

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
Or maybe better would be
Code:
ls -l /etc/localtime-copied-from | cut -d '/' -f 7-8
 
Old 07-09-2016, 02:13 AM   #4
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth&Mars (I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that work on freest-HW; has been KDE, CLI, Novena-SBC but open.. http://goo.gl/NqgqJx &c ;-)
Posts: 4,888
Blog Entries: 2

Rep: Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567
Or:
Code:
tail -n 1 /etc/localtime*
unless the OP (Mfoley) can be more disruptive, are we talking in your clock? E.g: http://docs.xfce.org/xfce/xfce4-panel/clock
 
Old 07-09-2016, 02:24 AM   #5
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth&Mars (I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that work on freest-HW; has been KDE, CLI, Novena-SBC but open.. http://goo.gl/NqgqJx &c ;-)
Posts: 4,888
Blog Entries: 2

Rep: Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567
In which case, perhaps:
Quote:
%c America, New York
 
Old 07-10-2016, 12:11 PM   #6
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,555

Original Poster
Rep: Reputation: 177Reputation: 177
Quote:
Originally Posted by chris.willing View Post
Maybe
Code:
ls -l /etc/localtime-copied-from
That may end up being the best I can do on Linux. In fact I was literally looking for "America/New_York" out there somewhere as that is the timezone designation used in ics (calendar) files in Outlook, Thunderbird Lightning and probably everyone's ics format. However, that doesn't mean it is a standard beyond ics.

For example, the Thunderbird error console gives: "Couldn't find (UTC-5:00) Eastern Time (US & Canada)", for entries so marked.

I guess I can always set it as a global environment variable.

jamison20000e:
Quote:
In which case, perhaps: %c America, New York
Where does that "%c America, New York" go? Looks like part of a format parameter to some command, but I don't see the context.

Last edited by mfoley; 07-10-2016 at 12:14 PM.
 
Old 07-10-2016, 01:02 PM   #7
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth&Mars (I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that work on freest-HW; has been KDE, CLI, Novena-SBC but open.. http://goo.gl/NqgqJx &c ;-)
Posts: 4,888
Blog Entries: 2

Rep: Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567
I thought maybe you were setting a GUI's clock? I should have included it in the above post as an edit.
 
Old 07-10-2016, 04:47 PM   #8
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 915

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
Quote:
Originally Posted by mfoley View Post
That may end up being the best I can do on Linux. In fact I was literally looking for "America/New_York"
That's why I later added
Code:
ls -l /etc/localtime-copied-from | cut -d '/' -f 7-8
. That should give you exactly "America/New_York" (or whatever).


Quote:
Originally Posted by mfoley View Post
I guess I can always set it as a global environment variable.
Some distros set the TZ environment variable - perhaps set that in /etc/profile?

chris
 
Old 07-10-2016, 05:57 PM   #9
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,555

Original Poster
Rep: Reputation: 177Reputation: 177
Quote:
Originally Posted by chris.willing View Post
Some distros set the TZ environment variable - perhaps set that in /etc/profile?
Not Slackware, and putting it in /etc/profile does no good for cron jobs. That's for a login shell only.

This works (from the web)

Code:
$ printf "2\n49\n1\n1\n" | tzselect 2>&1 | tail -1
America/New_York
However, you still have to know the menu navigation (2, 49, 1, 1) to get the right value. That is no better than simply knowing the timezone string you want and setting that directly in the script. Which is what I'm currently doing with

TZ=America/New_York
 
Old 07-10-2016, 06:24 PM   #10
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
I just cleared up some confusion that I had because of this post. This might also help others.

By default, Slackware's timeconfig utility (which is run during the setup process) lists the US timezones first. If you never scrolled down to the "America" section, you might've just selected Eastern (which is the same timezone as America/New_York), so the command provided by chris.willing would output:

Code:
jbhansen@craven-moorhead:~$ ls -l /etc/localtime-copied-from | cut -d '/' -f 7-8
US/Eastern
However, if you scroll further down the timeconfig timezone section to the America section, you could then select America/New_York, which would make his command work as intended.

So, mfoley, if you've been getting US/Eastern when you were wanting America/New_York, use the timeconfig script to change your system to the one you desire.

If you were already aware of this and were wanting something different, sorry for the noise.
 
Old 07-10-2016, 07:25 PM   #11
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 915

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
What I was suggesting was to insert something like
Code:
export TZ=$(ls -l /etc/localtime-copied-from | cut -d '/' -f 7-8)
into /etc/profile - or into any script run by cron (previous mention of which which I had missed).

Of course it will only set TZ to the value already set up with timeconfig, as bassmadrigal has pointed out.

chris
 
Old 07-11-2016, 05:26 AM   #12
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
chris.willing is on to something useful ... here is another way to do what he did.

You could make a script say, getzone in your PATH and chmod 755 /path/to/getzone

Code:
#!/bin/sh
#
# getzone ... expands your TZ to the long name symlinked from /etc/localtime-copied-from into /usr/share/zoneinfo/
#
tmpTZ=""

[ -L /etc/localtime-copied-from ] && tmpTZ="$(readlink /etc/localtime-copied-from |sed -e 's|/usr/share/zoneinfo/||')"

if [ "$tmpTZ" != "" ]
then
   echo "$tmpTZ"
   exit 0
else
   date '+%Z'
   exit 1
fi
Test it ...

Code:
$ date
Mon Jul 11 05:23:41 CDT 2016

$ getzone
US/Central

$FooVarb="$(getzone)" ; echo $FooVarb
US/Central
HTH ...

-- kjh

Last edited by kjhambrick; 07-11-2016 at 05:27 AM. Reason: left off info from description line
 
Old 07-11-2016, 06:02 AM   #13
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
oops ... just saw the ical post ...

Does the tz_convert command do what you need ?

-- kjh
 
  


Reply

Tags
timezone



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
Can I change the (long, long) UUID of a USB flash drive to something short? Zwergele Linux - Newbie 6 11-10-2013 09:55 AM
kmail - takes too long to retrieve a mail from a long thread (imap) eantoranz Linux - Software 1 10-24-2013 06:28 PM
An awful Comcast experience (warning: long long post) Cultist General 3 09-21-2013 11:50 AM
LXer: This week at LWN: Long discussions about long names LXer Syndicated Linux News 0 05-19-2009 10:50 PM
Long standing USB problem with XP & Linux...long cbjhawks Linux - Hardware 4 02-23-2009 08:32 AM

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

All times are GMT -5. The time now is 07:43 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