Bug#705566: date does not read the timezone from the environment variable TZ, and there is no other way to view from the CLI times in other timezones.

2022-08-12 Thread Michael Stone

On Fri, Aug 12, 2022 at 12:18:20PM +0200, Uwe Kleine-König wrote:

uwe@taurus:/usr/share/zoneinfo$ TZ=Europe/London date
Fri Aug 12 11:13:34 AM BST 2022
uwe@taurus:/usr/share/zoneinfo$ TZ=BST date
Fri Aug 12 10:13:38 AM BST 2022

The first one is the right one, but there is no way to determine the
latter to be wrong. Apart from the offset the output is identical and if
you're not aware that TZ=BST is wrong you have no chance to notice that.

If it at least said "Fri Aug 12 11:13:38 AM UTC 2022" or (better yet)
dies with an error code that would be highly convenient.


It would also be non-compliant with the standard. I'll pile on with what 
everyone else said, and repeat that the only practical solution is to 
not do what you're doing because the functionality is fundamentally 
unreliable. The ideal solution would be to drop support for three letter 
timezone codes entirely, but that's untenable from a compatibility 
standpoint.




Bug#705566: date does not read the timezone from the environment variable TZ, and there is no other way to view from the CLI times in other timezones.

2022-08-12 Thread Pádraig Brady

On 12/08/2022 11:18, Uwe Kleine-König wrote:

On Sun, May 05, 2013 at 05:43:38PM -0600, Bob Proulx wrote:

severity 705566 normal
thanks

Laurence Maddox wrote:

I get this output:
Current default time zone: 'America/Chicago'
Local time is now:  Tue Apr 16 14:45:29 CDT 2013.
Universal Time is now:  Tue Apr 16 19:45:29 UTC 2013.


Looks okay.  What output did you expect?


I need to view on the CLI the time in various timezones.
...
I have searched for the "right" way to complete my task, and found a link here:
http://www.linuxquestions.org/questions/programming-9/display-different-timezones-in-command-line-927660/

That link recommends that I complete my task using a command like this one:
TZ=UTC date && TZ=CDT date && TZ=IST date


The concept is reasonable but you must pick a correct timezone for
what you want to accomplish.  UTC is okay.  But CDT and IST are
meaningless to libc.  The GNU libc has no concept of invalid
timezones.  If a timezone doesn't match anything else then the default
is that it is a name for UTC.  So basically you have asked for UTC
three times in a row.


I stumbled about a similar thing just now and would consider this
behaviour at least inconsistent:

uwe@taurus:/usr/share/zoneinfo$ TZ=Europe/London date
Fri Aug 12 11:13:34 AM BST 2022
uwe@taurus:/usr/share/zoneinfo$ TZ=BST date
Fri Aug 12 10:13:38 AM BST 2022

The first one is the right one, but there is no way to determine the
latter to be wrong. Apart from the offset the output is identical and if
you're not aware that TZ=BST is wrong you have no chance to notice that.

If it at least said "Fri Aug 12 11:13:38 AM UTC 2022" or (better yet)
dies with an error code that would be highly convenient.

And given that the timezone specifier in the output is "BST" (in both
cases!) noticing that TZ=BST is wrong isn't as trivial as it should be.

Note that using -R doesn't help here either because then I have to
notice that "+" is wrong, but to find the offset from me to BST was
the actual task to solve here ...


In my experience using POSIX timezone specifications
leads to ambiguity and they're not really usable.
Instead it's best to use the longer form location based zones where possible.
I've expanded on this here:
https://www.pixelbeat.org/docs/linux_timezones/

thanks,
Pádraig



Bug#705566: date does not read the timezone from the environment variable TZ, and there is no other way to view from the CLI times in other timezones.

2022-08-12 Thread Uwe Kleine-König
On Sun, May 05, 2013 at 05:43:38PM -0600, Bob Proulx wrote:
> severity 705566 normal
> thanks
> 
> Laurence Maddox wrote:
> > I get this output:
> > Current default time zone: 'America/Chicago'
> > Local time is now:  Tue Apr 16 14:45:29 CDT 2013.
> > Universal Time is now:  Tue Apr 16 19:45:29 UTC 2013.
> 
> Looks okay.  What output did you expect?
> 
> > I need to view on the CLI the time in various timezones.
> > ...
> > I have searched for the "right" way to complete my task, and found a link 
> > here:
> > http://www.linuxquestions.org/questions/programming-9/display-different-timezones-in-command-line-927660/
> > 
> > That link recommends that I complete my task using a command like this one:
> > TZ=UTC date && TZ=CDT date && TZ=IST date
> 
> The concept is reasonable but you must pick a correct timezone for
> what you want to accomplish.  UTC is okay.  But CDT and IST are
> meaningless to libc.  The GNU libc has no concept of invalid
> timezones.  If a timezone doesn't match anything else then the default
> is that it is a name for UTC.  So basically you have asked for UTC
> three times in a row.

I stumbled about a similar thing just now and would consider this
behaviour at least inconsistent:

uwe@taurus:/usr/share/zoneinfo$ TZ=Europe/London date
Fri Aug 12 11:13:34 AM BST 2022
uwe@taurus:/usr/share/zoneinfo$ TZ=BST date
Fri Aug 12 10:13:38 AM BST 2022

The first one is the right one, but there is no way to determine the
latter to be wrong. Apart from the offset the output is identical and if
you're not aware that TZ=BST is wrong you have no chance to notice that.

If it at least said "Fri Aug 12 11:13:38 AM UTC 2022" or (better yet)
dies with an error code that would be highly convenient.

And given that the timezone specifier in the output is "BST" (in both
cases!) noticing that TZ=BST is wrong isn't as trivial as it should be.

Note that using -R doesn't help here either because then I have to
notice that "+" is wrong, but to find the offset from me to BST was
the actual task to solve here ...

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | https://www.pengutronix.de/ |


signature.asc
Description: PGP signature


Bug#705566: date does not read the timezone from the environment variable TZ, and there is no other way to view from the CLI times in other timezones.

2013-05-05 Thread Bob Proulx
severity 705566 normal
thanks

Laurence Maddox wrote:
 I get this output:
 Current default time zone: 'America/Chicago'
 Local time is now:  Tue Apr 16 14:45:29 CDT 2013.
 Universal Time is now:  Tue Apr 16 19:45:29 UTC 2013.

Looks okay.  What output did you expect?

 I need to view on the CLI the time in various timezones.
 ...
 I have searched for the right way to complete my task, and found a link 
 here:
 http://www.linuxquestions.org/questions/programming-9/display-different-timezones-in-command-line-927660/
 
 That link recommends that I complete my task using a command like this one:
 TZ=UTC date  TZ=CDT date  TZ=IST date

The concept is reasonable but you must pick a correct timezone for
what you want to accomplish.  UTC is okay.  But CDT and IST are
meaningless to libc.  The GNU libc has no concept of invalid
timezones.  If a timezone doesn't match anything else then the default
is that it is a name for UTC.  So basically you have asked for UTC
three times in a row.

 However, I get this output, which is obviously not what it should be:
 Tue Apr 16 19:45:39 UTC 2013
 Tue Apr 16 19:45:39 CDT 2013
 Tue Apr 16 19:45:39 IST 2013

Try this:

  $ env TZ=US/Eastern date
  Sun May  5 19:37:04 EDT 2013

  $ env TZ=US/Central date
  Sun May  5 18:37:07 CDT 2013

  $ env TZ=US/Mountain date
  Sun May  5 17:37:07 MDT 2013

  $ env TZ=US/Pacific date
  Sun May  5 16:37:08 PDT 2013

However the named timezones are ambiguous.  The use of the above
legacy format is really terrible for knowing for sure what time it is
and which timezone you are in.  That is the entire reason for the
standard time strings.  I use and recommend -R to print the time
string in an unambiguous standard format.

  $ env TZ=US/Mountain date -R
  Sun, 05 May 2013 17:43:03 -0600

See also the FAQ where there is extensive discussion of using the date
command for this task.

  
http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e

Bob


signature.asc
Description: Digital signature


Bug#705566: date does not read the timezone from the environment variable TZ, and there is no other way to view from the CLI times in other timezones.

2013-04-24 Thread Dirk Eddelbuettel

reassign 705566
quit

'date' is /bin/date, from package coreutils.

This bug was filed against (source) package date for R package r-bin-date,
which is not providing /bin/date.

Dirk

On 16 April 2013 at 13:09, Laurence Maddox wrote:
| Package: date
| Severity: important
| Tags: l10n
| 
| I need to view on the CLI the time in various timezones.
| 
| 
| 
| I have correctly configured the time and timezone to the best of my knowledge.
| I use this command:
| dpkg-reconfigure tzdata  ntpdate pool.ntp.org  hwclock --systohc --utc
| 
| 
| 
| I get this output:
| Current default time zone: 'America/Chicago'
| Local time is now:  Tue Apr 16 14:45:29 CDT 2013.
| Universal Time is now:  Tue Apr 16 19:45:29 UTC 2013.
| 
| 16 Apr 19:45:38 ntpdate[12036]: adjust time server 199.102.46.73 offset
| -0.036668 sec
| 
| 
| 
| 
| I have searched for the right way to complete my task, and found a link 
here:
| http://www.linuxquestions.org/questions/programming-9/
| display-different-timezones-in-command-line-927660/
| 
| That link recommends that I complete my task using a command like this one:
| TZ=UTC date  TZ=CDT date  TZ=IST date
| 
| 
| 
| However, I get this output, which is obviously not what it should be:
| Tue Apr 16 19:45:39 UTC 2013
| Tue Apr 16 19:45:39 CDT 2013
| Tue Apr 16 19:45:39 IST 2013
| 
| 
| -- System Information:
| Debian Release: 6.0.6
|   APT prefers stable-updates
|   APT policy: (500, 'stable-updates'), (500, 'proposed-updates'), (500,
| 'testing'), (500, 'stable')
| Architecture: amd64 (x86_64)
| 
| Kernel: Linux 2.6.32-5-amd64 (SMP w/8 CPU cores)
| Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
| Shell: /bin/sh linked to /bin/dash

-- 
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#705566: date does not read the timezone from the environment variable TZ, and there is no other way to view from the CLI times in other timezones.

2013-04-16 Thread Laurence Maddox
Package: date
Severity: important
Tags: l10n

I need to view on the CLI the time in various timezones.



I have correctly configured the time and timezone to the best of my knowledge. 
I use this command:
dpkg-reconfigure tzdata  ntpdate pool.ntp.org  hwclock --systohc --utc



I get this output:
Current default time zone: 'America/Chicago'
Local time is now:      Tue Apr 16 14:45:29 CDT 2013.
Universal Time is now:  Tue Apr 16 19:45:29 UTC 2013.

16 Apr 19:45:38 ntpdate[12036]: adjust time server 199.102.46.73 offset 
-0.036668 sec




I have searched for the right way to complete my task, and found a link here:
http://www.linuxquestions.org/questions/programming-9/display-different-timezones-in-command-line-927660/

That link recommends that I complete my task using a command like this one:
TZ=UTC date  TZ=CDT date  TZ=IST date



However, I get this output, which is obviously not what it should be:
Tue Apr 16 19:45:39 UTC 2013
Tue Apr 16 19:45:39 CDT 2013
Tue Apr 16 19:45:39 IST 2013


-- System Information:
Debian Release: 6.0.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'proposed-updates'), (500, 
'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Bug#705566: date does not read the timezone from the environment variable TZ, and there is no other way to view from the CLI times in other timezones.

2013-04-16 Thread Dirk Eddelbuettel

On 16 April 2013 at 13:09, Laurence Maddox wrote:
| Package: date
| Severity: important
| Tags: l10n
| 
| I need to view on the CLI the time in various timezones.
| 
| 
| 
| I have correctly configured the time and timezone to the best of my knowledge.
| I use this command:
| dpkg-reconfigure tzdata  ntpdate pool.ntp.org  hwclock --systohc --utc
| 

Here is a simple counter-example:

   edd@max:~$ date  # my local time
   Tue Apr 16 15:49:02 CDT 2013
   edd@max:~$ TZ=America/Los_Angeles date # arbitrary other TZ
   Tue Apr 16 13:49:15 PDT 2013

which works just fine.

   edd@max:~$ which date
   /bin/date
   edd@max:~$ date --version
   date (GNU coreutils) 8.13
   Copyright (C) 2011 Free Software Foundation, Inc.
   License GPLv3+: GNU GPL version 3 or later
   http://gnu.org/licenses/gpl.html.
   This is free software: you are free to change and redistribute it.
   There is NO WARRANTY, to the extent permitted by law.

   Written by David MacKenzie.
   edd@max:~$ 

Dirk

| 
| 
| I get this output:
| Current default time zone: 'America/Chicago'
| Local time is now:  Tue Apr 16 14:45:29 CDT 2013.
| Universal Time is now:  Tue Apr 16 19:45:29 UTC 2013.
| 
| 16 Apr 19:45:38 ntpdate[12036]: adjust time server 199.102.46.73 offset
| -0.036668 sec
| 
| 
| 
| 
| I have searched for the right way to complete my task, and found a link 
here:
| http://www.linuxquestions.org/questions/programming-9/
| display-different-timezones-in-command-line-927660/
| 
| That link recommends that I complete my task using a command like this one:
| TZ=UTC date  TZ=CDT date  TZ=IST date
| 
| 
| 
| However, I get this output, which is obviously not what it should be:
| Tue Apr 16 19:45:39 UTC 2013
| Tue Apr 16 19:45:39 CDT 2013
| Tue Apr 16 19:45:39 IST 2013
| 
| 
| -- System Information:
| Debian Release: 6.0.6
|   APT prefers stable-updates
|   APT policy: (500, 'stable-updates'), (500, 'proposed-updates'), (500,
| 'testing'), (500, 'stable')
| Architecture: amd64 (x86_64)
| 
| Kernel: Linux 2.6.32-5-amd64 (SMP w/8 CPU cores)
| Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
| Shell: /bin/sh linked to /bin/dash

-- 
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org