Please help me with TZ=aaa24 date +%Y%m%d

Please help me with TZ=aaa24 date +%Y%m%d

am 15.02.2006 14:12:05 von Krish

Hi,
Can anyone please tell me what 'aaa' in TZ=aaa24 date +%Y%m%d
stands for. I have searched the unix man pages but not able to get its
meaning.

Thanks,
Krishna

Re: Please help me with TZ=aaa24 date +%Y%m%d

am 15.02.2006 14:50:32 von Barry Margolin

In article <1140009125.370331.220220@f14g2000cwb.googlegroups.com>,
"krish" wrote:

> Hi,
> Can anyone please tell me what 'aaa' in TZ=aaa24 date +%Y%m%d
> stands for. I have searched the unix man pages but not able to get its
> meaning.

It's the name of a time zone, which can be found in /usr/share/zoneinfo.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***

Re: Please help me with TZ=aaa24 date +%Y%m%d

am 15.02.2006 15:26:49 von Stephane CHAZELAS

On 15 Feb 2006 05:12:05 -0800, krish wrote:
> Hi,
> Can anyone please tell me what 'aaa' in TZ=aaa24 date +%Y%m%d
> stands for. I have searched the unix man pages but not able to get its
> meaning.
[...]

as long as you use the format TZ=

will just be some descriptive text that you chose to
describe that rule. As long as you specify an offset (it could
be even more complicated like having two offsets for day light
saving time, and rules to tell when to switch to DST), then the
is not used to define the rules (aaa will not refer to
any description file in /usr/share/zoneinfo contrary to another
contributor said), it will just be used in date +%Z.

So, TZ=aaa24 is a tab zone called "aaa" that is defined as being
offset by 24 wrt Universal time (GMT, UTC).

If you had specified:

TZ=aaa

so, without any rule embeded in $TZ, then "aaa" would have
refered to a system wide timezone, whose rules are defined in a
system wide description file (on some systems in
/usr/share/zoneinfo).

$ TZ=aaa truss -t open date
open("/var/ld/ld.config", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libc.so.1", O_RDONLY) = 3
open("/usr/lib/libdl.so.1", O_RDONLY) = 3
open("/usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1", O_RDONLY) = 3
open("/usr/share/lib/zoneinfo/aaa", O_RDONLY) Err#2 ENOENT
open("/usr/share/lib/zoneinfo/aaa", O_RDONLY) Err#2 ENOENT
open("/usr/share/lib/zoneinfo/aaa", O_RDONLY) Err#2 ENOENT

My system doesn't have such system-wide timezone.

$ TZ=Brazil/Acre truss -t open date
open("/var/ld/ld.config", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libc.so.1", O_RDONLY) = 3
open("/usr/lib/libdl.so.1", O_RDONLY) = 3
open("/usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1", O_RDONLY) = 3
open("/usr/share/lib/zoneinfo/Brazil/Acre", O_RDONLY) = 3
Wed Feb 15 09:24:47 AST 2006

It does have one called Brazil/Acre, but if I decide to specify
the rules for Brazil/Acre to say that it's 24 hours behind UTC:

$ TZ=Brazil/Acre24 truss -t open date
open("/var/ld/ld.config", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libc.so.1", O_RDONLY) = 3
open("/usr/lib/libdl.so.1", O_RDONLY) = 3
open("/usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1", O_RDONLY) = 3
Tue Feb 14 14:25:41 Brazil/Acre 2006

the system-wide description file is not used.

--
Stephane

Re: Please help me with TZ=aaa24 date +%Y%m%d

am 15.02.2006 16:34:26 von Krish

Thanks a lot Stephane

Re: Please help me with TZ=aaa24 date +%Y%m%d

am 16.02.2006 16:59:27 von Greg Beeker

krish wrote:
> Hi,
> Can anyone please tell me what 'aaa' in TZ=aaa24 date +%Y%m%d
> stands for. I have searched the unix man pages but not able to get its
> meaning.
>
> Thanks,
> Krishna

My thought is that the aaa is only a timezone that is *not* defined on
the system, but the trick is that running that command gets the
properly formed date for *yesterday*, or 24 hours ago, ignoring the
time.
Which is quite a trick considering the difficult calculation to find
the date for yesterday, with different days per month, and leap years
and such.

$ date;TZ=aaa24 date
Thu Feb 16 10:54:45 EST 2006
Wed Feb 15 15:54:46 aaa 2006

Anyone else get this same idea?