Bug report for "date"

2009-07-28 Thread Paul Grinberg
Hi,

 

Gives me correct date:

 

[ctpsmg11-dcdhealth@/opt/app/dcdhealth] # TZ=EDT+150 date

Wed Jul 22 12:27:15 EDT 2009

 

 

Gives me incorrect date:

[ctpsmg11-dcdhealth@/opt/app/dcdhealth] # TZ=EDT+172 date

Tue Jul 28 18:27:09 GMT 2009

 

Basically I cannot go back more than 6 days...

 

Best,

Paul

 

___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: Bug report for "date"

2009-07-28 Thread Bob Proulx
Paul Grinberg wrote:
> Gives me correct date:
> [ctpsmg11-dcdhealth@/opt/app/dcdhealth] # TZ=EDT+150 date
> Wed Jul 22 12:27:15 EDT 2009
> 
> Gives me incorrect date:
> [ctpsmg11-dcdhealth@/opt/app/dcdhealth] # TZ=EDT+172 date
> Tue Jul 28 18:27:09 GMT 2009
> 
> Basically I cannot go back more than 6 days...

You have specified an invalid timezone.  Timezones are only defined
from 0 through 23 hours 59 seconds which is sufficient to define all
existing timezones.  Please see the GNU C manual for a complete
specification of the timezone using the TZ variable.

  http://www.gnu.org/software/coreutils/manual/libc.html#TZ-Variable

  The offset specifies the time value you must add to the local time
  to get a Coordinated Universal Time value.  It has syntax like
  [+|-]hh[:mm[:ss]].  This is positive if the local time zone is west
  of the Prime Meridian and negative if it is east.  The hour must be
  between 0 and 23, and the minute and seconds between 0 and 59.

If you are trying to do math calculations using date then it is better
to use date's relative time feature.

  $ date -R --date="-14 days"
  Tue, 14 Jul 2009 17:04:43 -0600

Bob


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: Bug report for "date"

2009-07-28 Thread Philip Rowlands

On Tue, 28 Jul 2009, Paul Grinberg wrote:


Gives me correct date:

[ctpsmg11-dcdhealth@/opt/app/dcdhealth] # TZ=EDT+150 date
Wed Jul 22 12:27:15 EDT 2009

Gives me incorrect date:
[ctpsmg11-dcdhealth@/opt/app/dcdhealth] # TZ=EDT+172 date
Tue Jul 28 18:27:09 GMT 2009

Basically I cannot go back more than 6 days...


According to the POSIX/glibc definition of TZ:
http://www.opengroup.org/onlinepubs/95399/basedefs/xbd_chap08.html
http://www.gnu.org/s/libc/manual/html_node/TZ-Variable.html

the hour offset must be between 0 and 24. In other words, the examples 
above are undefined by the standards. Why are you trying to use TZ to 
concoct multi-day offsets?



Cheers,
Phil


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


RE: Bug report for "date"

2009-07-28 Thread Philip Rowlands

On Tue, 28 Jul 2009, Paul Grinberg wrote:


Shell script for SolarisIt can go future as long as I want, but past
only 6 days

http://www.isrcomputing.com/index.php?option=com_content&view=article&id=125:unix-shell-script-to-calculate-date-in-the-future-and-in-the-past&catid=38:technology-tips&Itemid=82


That script is using (/abusing) TZ beyond its stated purpose. As Bob 
suggests, GNU date can perform date calculations with relative offsets, 
e.g.


$ date -d 'now + 12 days'
Mon Aug 10 00:55:32 BST 2009


Cheers,
Phil



___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


RE: Bug report for "date"

2009-07-28 Thread Paul Grinberg
Bob,

Thank you for your reply. You are right, I am trying to calculate time
backwardsit only allows 6 days back...i need 7 :) the whole week :)

Unfortunately in solaris it does not work :(((

# date -R --date="-14 days"
date: illegal option -- R
date: illegal option -- date=-14 days
usage:  date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]

Thanks,
Paul


-Original Message-
From: Bob Proulx [mailto:b...@proulx.com] 
Sent: Tuesday, July 28, 2009 7:08 PM
To: Paul Grinberg
Cc: bug-coreutils@gnu.org
Subject: Re: Bug report for "date"

Paul Grinberg wrote:
> Gives me correct date:
> [ctpsmg11-dcdhealth@/opt/app/dcdhealth] # TZ=EDT+150 date
> Wed Jul 22 12:27:15 EDT 2009
> 
> Gives me incorrect date:
> [ctpsmg11-dcdhealth@/opt/app/dcdhealth] # TZ=EDT+172 date
> Tue Jul 28 18:27:09 GMT 2009
> 
> Basically I cannot go back more than 6 days...

You have specified an invalid timezone.  Timezones are only defined
from 0 through 23 hours 59 seconds which is sufficient to define all
existing timezones.  Please see the GNU C manual for a complete
specification of the timezone using the TZ variable.

  http://www.gnu.org/software/coreutils/manual/libc.html#TZ-Variable

  The offset specifies the time value you must add to the local time
  to get a Coordinated Universal Time value.  It has syntax like
  [+|-]hh[:mm[:ss]].  This is positive if the local time zone is west
  of the Prime Meridian and negative if it is east.  The hour must be
  between 0 and 23, and the minute and seconds between 0 and 59.

If you are trying to do math calculations using date then it is better
to use date's relative time feature.

  $ date -R --date="-14 days"
  Tue, 14 Jul 2009 17:04:43 -0600

Bob


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


RE: Bug report for "date"

2009-07-28 Thread Paul Grinberg
Shell script for SolarisIt can go future as long as I want, but past
only 6 days

http://www.isrcomputing.com/index.php?option=com_content&view=article&id
=125:unix-shell-script-to-calculate-date-in-the-future-and-in-the-past&c
atid=38:technology-tips&Itemid=82


Best,
Paul


-Original Message-
From: Philip Rowlands [mailto:p...@doc.ic.ac.uk] 
Sent: Tuesday, July 28, 2009 7:40 PM
To: Paul Grinberg
Cc: bug-coreutils@gnu.org
Subject: Re: Bug report for "date"

On Tue, 28 Jul 2009, Paul Grinberg wrote:

> Gives me correct date:
>
> [ctpsmg11-dcdhealth@/opt/app/dcdhealth] # TZ=EDT+150 date
> Wed Jul 22 12:27:15 EDT 2009
>
> Gives me incorrect date:
> [ctpsmg11-dcdhealth@/opt/app/dcdhealth] # TZ=EDT+172 date
> Tue Jul 28 18:27:09 GMT 2009
>
> Basically I cannot go back more than 6 days...

According to the POSIX/glibc definition of TZ:
http://www.opengroup.org/onlinepubs/95399/basedefs/xbd_chap08.html
http://www.gnu.org/s/libc/manual/html_node/TZ-Variable.html

the hour offset must be between 0 and 24. In other words, the examples 
above are undefined by the standards. Why are you trying to use TZ to 
concoct multi-day offsets?


Cheers,
Phil


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


RE: Bug report for "date"

2009-07-28 Thread Paul Grinberg
Phil,

 As I said...it is a workaround, since ins Solaris you cannot execute
that command:

# date -R --date="-14 days"
date: illegal option -- R
date: illegal option -- date=-14 days
usage:  date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]


Best,
Paul


-Original Message-
From: Philip Rowlands [mailto:p...@doc.ic.ac.uk] 
Sent: Tuesday, July 28, 2009 7:56 PM
To: Paul Grinberg
Cc: bug-coreutils@gnu.org
Subject: RE: Bug report for "date"

On Tue, 28 Jul 2009, Paul Grinberg wrote:

> Shell script for SolarisIt can go future as long as I want, but
past
> only 6 days
>
>
http://www.isrcomputing.com/index.php?option=com_content&view=article&id
=125:unix-shell-script-to-calculate-date-in-the-future-and-in-the-past&c
atid=38:technology-tips&Itemid=82

That script is using (/abusing) TZ beyond its stated purpose. As Bob 
suggests, GNU date can perform date calculations with relative offsets, 
e.g.

$ date -d 'now + 12 days'
Mon Aug 10 00:55:32 BST 2009


Cheers,
Phil



___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: Bug report for "date"

2009-07-28 Thread Bob Proulx
Paul Grinberg wrote:
> Thank you for your reply. You are right, I am trying to calculate time
> backwardsit only allows 6 days back...i need 7 :) the whole week :)
>
> Unfortunately in solaris it does not work :(((

Well, this is the mailing list for the GNU system's date and so you
wouldn't expect us to suggest anything other than that perhaps you
might consider switching to the GNU system.  It works there!  :-)

> # date -R --date="-14 days"
> date: illegal option -- R
> date: illegal option -- date=-14 days
> usage:  date [-u] mmddHHMM[[cc]yy][.SS]
> date [-u] [+format]
> date -a [-]sss[.fff]

Well, that isn't the GNU date so there isn't anything that we can say
here that will help you there.  Good luck!

Do you have Perl, Python or Ruby?  You might try doing date
calculations using Perl and the Date::Calc library.

Bob


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


RE: Bug report for "date"

2009-07-28 Thread Paul Grinberg
Perl is my friend :)))


Best,
Paul


-Original Message-
From: Bob Proulx [mailto:b...@proulx.com] 
Sent: Tuesday, July 28, 2009 8:29 PM
To: Paul Grinberg
Cc: bug-coreutils@gnu.org
Subject: Re: Bug report for "date"

Paul Grinberg wrote:
> Thank you for your reply. You are right, I am trying to calculate time
> backwardsit only allows 6 days back...i need 7 :) the whole week
:)
>
> Unfortunately in solaris it does not work :(((

Well, this is the mailing list for the GNU system's date and so you
wouldn't expect us to suggest anything other than that perhaps you
might consider switching to the GNU system.  It works there!  :-)

> # date -R --date="-14 days"
> date: illegal option -- R
> date: illegal option -- date=-14 days
> usage:  date [-u] mmddHHMM[[cc]yy][.SS]
> date [-u] [+format]
> date -a [-]sss[.fff]

Well, that isn't the GNU date so there isn't anything that we can say
here that will help you there.  Good luck!

Do you have Perl, Python or Ruby?  You might try doing date
calculations using Perl and the Date::Calc library.

Bob


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils