Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #229030
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | David Wright <deblis@lionunicorn.co.uk> |
| Newsgroups | linux.debian.user |
| Subject | Re: 780 files in /usr/share/zoneinfo/ |
| Date | Tue, 24 Nov 2020 20:50:01 +0100 |
| Message-ID | <BeMu5-6Gi-1@gated-at.bofh.it> (permalink) |
| References | <BejBL-66b-3@gated-at.bofh.it> <Beznb-7fe-5@gated-at.bofh.it> <BeGf0-37C-9@gated-at.bofh.it> <BeJcS-4Rz-13@gated-at.bofh.it> <BeJmx-4UN-1@gated-at.bofh.it> <BeJZf-5nc-5@gated-at.bofh.it> <BeKVj-5Vy-7@gated-at.bofh.it> |
| X-Original-To | debian-user@lists.debian.org |
| X-Mailbox-Line | From debian-user-request@lists.debian.org Tue Nov 24 19:41:46 2020 |
| Old-Return-Path | <pdkcox@cox.net> |
| X-Amavis-Spam-Status | No, score=-6.651 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, FOURLA=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, LDO_WHITELIST=-5, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham autolearn_force=no |
| X-Policyd-Weight | using cached result; rate: -5.5 |
| Authentication-Results | cox.net; auth=pass (PLAIN) smtp.auth=pdkcox@cox.net |
| X-Authority-Analysis | v=2.4 cv=ROR2o6u+ c=1 sm=1 tr=0 ts=5fbd61e9 a=kkeJ8LlWWq7dYbO4WG5cmA==:117 a=kkeJ8LlWWq7dYbO4WG5cmA==:17 a=kj9zAlcOel0A:10 a=MdSiB5jmxfHikgevsG0A:9 a=CjuIK1q_8ugA:10 |
| Reply-To | debian-user@lists.debian.org |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.10.1 (2018-07-13) |
| X-Cmae-Envelope | MS4xfF+lBcWbZmD46zgg6A+AKsVR7D6jLuMWlcBl+rLIOfMUUobN/fWXvrTHBRKeM5MPTCOFmB9lYIU+xGVb+gOax/EaXPbFnxlG7ITgMyV/3jsCLsUnbTu4 3+wXOhExeeO0VzaU273rAv1ft0SGegA9RxndndBfCCufGrZ6eZ+UKei33SkNijnENQSDYNMCekk42y4QPGfjtllXVA0QSs6/0qskIxvgTcnncjcCVcyIzmGW UTFtHzeLKZ+xt4349VnuZRRBqC/v0z82A4d+wlF6LUo= |
| X-Mailing-List | <debian-user@lists.debian.org> archive/latest/769446 |
| List-ID | <debian-user.lists.debian.org> |
| List-URL | <https://lists.debian.org/debian-user/> |
| List-Archive | https://lists.debian.org/msgid-search/20201124194124.GA12503@axis.corp |
| Approved | robomod@news.nic.it |
| Lines | 97 |
| Organization | linux.* mail to news gateway |
| Sender | robomod@news.nic.it |
| X-Original-Date | Tue, 24 Nov 2020 13:41:24 -0600 |
| X-Original-Message-ID | <20201124194124.GA12503@axis.corp> |
| X-Original-References | <20201123125109.GM915@eeg.ccf.org> <20201124041647.GA22198@MikesPI> <20201124130916.GU915@eeg.ccf.org> <202011241115.54191.rhkramer@gmail.com> <87wnyad8n6.fsf@dhh.gt.org> <slrnrrqe61.253.curty@einstein.electron.org> <20201124180710.GX915@eeg.ccf.org> |
| Xref | csiph.com linux.debian.user:229030 |
Show key headers only | View raw
On Tue 24 Nov 2020 at 13:07:10 (-0500), Greg Wooledge wrote:
> On Tue, Nov 24, 2020 at 04:45:53PM +0000, Curt wrote:
> > I have a problem:
> >
> > curty@einstein:~$ TZ=EST date
> > Tue Nov 24 11:43:42 EST 2020
> > curty@einstein:~$ TZ=PST date
> > Tue Nov 24 16:43:54 PST 2020
>
> As I said, figuring out the valid TZ strings for a given location on
> our planet is a challenge. Unfortunately, the ... fine people ... who
> devised the standards for this sort of thing thought it would be really
> super clever to treat ALL unknown TZ strings as if they were "UTC0".
>
> unicorn:~$ date -u ; TZ=UTC0 date ; TZ=Imaginary/Neverland date
> Tue Nov 24 17:54:28 UTC 2020
> Tue Nov 24 17:54:28 UTC 2020
> Tue Nov 24 17:54:28 Imaginary 2020
>
> TZ=PST is yet another unknown TZ string, so it's treated as "UTC0", or
> the Coordinated Universal Time zone, and you don't even get a WARNING
> that this is the case. It just silently gives you a wrong answer.
>
> I've been personally bitten by this, and it sucks. So much.
>
> unicorn:~$ TZ=PST date ; TZ=PST8PDT date ; TZ=America/Los_Angeles date
> Tue Nov 24 17:56:16 PST 2020
> Tue Nov 24 09:56:16 PST 2020
> Tue Nov 24 09:56:16 PST 2020
>
> To add insult to injury, the string that date(1) gives you as OUTPUT
> (in this case, "PST") is not accepted by the very same program as INPUT.
> In fact, I don't know of any way to get date(1) to give an output string
> that you can use as a valid TZ input string. You have to discover these
> values yourself, using out-of-band means.
>
> One of the ways to generate a valid TZ name, if your target happens to
> be in the United States, is to construct one of the old school Unix time
> zone names:
>
> EST5EDT
> CST6CDT
> MST7MDT
> PST8PDT
>
> If you can remember "Eastern Central Mountain Pacific", and if you can
> remember the numeric offset for any single one of them, then you can
> derive the full set.
>
> Another set of TZ labels that works for the USA is the transitional
> set that was popular 10-20 years ago:
>
> US/Eastern
> US/Central
> US/Mountain
> US/Pacific
>
> Those are even easier to derive than the "EST5EDT" style ones, albeit
> slightly more characters to type.
>
> Outside of the USA, you'll probably need to go with the "nearest big
> city" names that are the current vogue. The best way to use those is
> probably "ls /usr/share/zoneinfo", choose your continent, and then
> (for example) "ls /usr/share/zoneinfo/Asia". Then pick a city from
> the resulting set, and pray.
>
> If there's a better way, I don't know it.
I wrote this a while back; it probably needs another bout of tidying up.
$ type whattime
whattime is a function
whattime ()
{
[ -z "$1" ] && printf '%s\n' "Usage: ${FUNCNAME[0]} there [where]
prints the time in where or where/there or there/where.
Note that the result has to be Region/Place with a /." 1>&2 && return 1;
local Wherea="${1,,}" Whereb="${1,,}";
[ -n "$2" ] && Wherea="${1,,}/${2,,}" && Whereb="${2,,}/${1,,}";
local Unique1="$(mktemp "${Uniquetrash:-/tmp}/${FUNCNAME[0]}"-"$(date +%s)"-XXXX)";
local Unique2="$(mktemp "${Uniquetrash:-/tmp}/${FUNCNAME[0]}"-"$(date +%s)"-XXXX)";
( cd /usr/share/zoneinfo || return 9;
ls -1 */* >> "$Unique1";
grep -i -e "${Wherea// /_}" "$Unique1" >> "$Unique2";
grep -i -e "${Whereb// /_}" "$Unique1" >> "$Unique2";
local Nmatches="$(grep -e '/' "$Unique2" | LC_ALL=C sort -u | tee "$Unique1" | wc -l)";
[ "$Nmatches" = "1" ] && TZ=$(cat "$Unique1") && printf '%s ' "$TZ" && date '+%Y-%m-%d %T %z %A' )
}
$ whattime pari
Europe/Paris 2020-11-24 20:38:35 +0100 Tuesday
$
It should work on any single partial match, as demonstrated.
Of course, it helps to know the names of a few major cities.
Cheers,
David.
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
780 files in /usr/share/zoneinfo/ mike.junk.46@att.net - 2020-11-21 03:50 +0100
Re: 780 files in /usr/share/zoneinfo/ Andy Smith <andy@strugglers.net> - 2020-11-21 04:10 +0100
Re: 780 files in /usr/share/zoneinfo/ John Hasler <jhasler@newsguy.com> - 2020-11-21 04:20 +0100
Re: 780 files in /usr/share/zoneinfo/ Paul Johnson <baloo@ursamundi.org> - 2020-11-21 04:30 +0100
Re: 780 files in /usr/share/zoneinfo/ <tomas@tuxteam.de> - 2020-11-21 10:00 +0100
Re: 780 files in /usr/share/zoneinfo/ "Martin McCormick" <martin.m@suddenlink.net> - 2020-11-21 20:30 +0100
Re: 780 files in /usr/share/zoneinfo/ Andy Smith <andy@strugglers.net> - 2020-11-21 22:40 +0100
Re: 780 files in /usr/share/zoneinfo/ Stefan Monnier <monnier@iro.umontreal.ca> - 2020-11-21 22:50 +0100
Re: 780 files in /usr/share/zoneinfo/ "Martin McCormick" <martin.m@suddenlink.net> - 2020-11-22 03:50 +0100
Re: 780 files in /usr/share/zoneinfo/ Andy Smith <andy@strugglers.net> - 2020-11-22 05:30 +0100
rsync link corruption with -H and --link-dest "Gareth Evans" <donotspam@fastmail.fm> - 2020-11-22 05:50 +0100
Re: 780 files in /usr/share/zoneinfo/ "Martin McCormick" <martin.m@suddenlink.net> - 2020-11-30 13:20 +0100
Re: 780 files in /usr/share/zoneinfo/ Charles Curley <charlescurley@charlescurley.com> - 2020-11-21 23:10 +0100
Re: Re: 780 files in /usr/share/zoneinfo/ Greg Wooledge <wooledg@eeg.ccf.org> - 2020-11-23 14:00 +0100
Re: 780 files in /usr/share/zoneinfo/ Charles Curley <charlescurley@charlescurley.com> - 2020-11-23 16:50 +0100
Re: Re: 780 files in /usr/share/zoneinfo/ Mike McClain <mike.junk.46@att.net> - 2020-11-24 06:50 +0100
Re: 780 files in /usr/share/zoneinfo/ Greg Wooledge <wooledg@eeg.ccf.org> - 2020-11-24 14:10 +0100
Re: 780 files in /usr/share/zoneinfo/ rhkramer@gmail.com - 2020-11-24 17:20 +0100
Re: 780 files in /usr/share/zoneinfo/ John Hasler <jhasler@newsguy.com> - 2020-11-24 17:30 +0100
Re: 780 files in /usr/share/zoneinfo/ Curt <curty@free.fr> - 2020-11-24 18:10 +0100
Re: 780 files in /usr/share/zoneinfo/ Greg Wooledge <wooledg@eeg.ccf.org> - 2020-11-24 19:10 +0100
Re: 780 files in /usr/share/zoneinfo/ rhkramer@gmail.com - 2020-11-24 19:40 +0100
Re: 780 files in /usr/share/zoneinfo/ David Wright <deblis@lionunicorn.co.uk> - 2020-11-24 20:50 +0100
Re: 780 files in /usr/share/zoneinfo/ Michael Stone <mstone@debian.org> - 2020-11-25 03:00 +0100
Re: 780 files in /usr/share/zoneinfo/ Stefan Monnier <monnier@iro.umontreal.ca> - 2020-11-24 15:50 +0100
Re: Re: 780 files in /usr/share/zoneinfo/ Michael Stone <mstone@debian.org> - 2020-11-24 17:10 +0100
Re: 780 files in /usr/share/zoneinfo/ "Martin McCormick" <martin.m@suddenlink.net> - 2020-11-30 14:10 +0100
Re: 780 files in /usr/share/zoneinfo/ John Hasler <jhasler@newsguy.com> - 2020-11-24 17:20 +0100
Re: 780 files in /usr/share/zoneinfo/ Gene Heskett <gheskett@shentel.net> - 2020-11-24 18:20 +0100
Re: 780 files in /usr/share/zoneinfo/ David Wright <deblis@lionunicorn.co.uk> - 2020-11-24 20:50 +0100
Re: 780 files in /usr/share/zoneinfo/ David Wright <deblis@lionunicorn.co.uk> - 2020-11-22 00:00 +0100
csiph-web