FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 01-08-2012, 09:32 AM
Dotan Cohen
 
Default Why the discrepancy in date?

For determining the current date, my date functions roundtrip just fine:
✈saturn:~$ date
Sun Jan 8 12:32:24 IST 2012
✈saturn:~$ date +%s
1326018753
✈saturn:~$ date -d @1326018753
Sun Jan 8 12:32:33 IST 2012


However, for dates in the past they do not:
✈saturn:~$ date +%s -d 2006-12-31t22:00
1167577200
✈saturn:~$ date -d @1167577200
Sun Dec 31 17:00:00 IST 2006
✈saturn:~$

Notice that 22:00 became 17:00 - that is a five hour difference!

As can be seen, I am on IST, which is UTC+2, so it does not account
for the discrepancy:
http://en.wikipedia.org/wiki/Israel_Standard_Time

This is on Kubuntu 11.10. Thanks.

--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-08-2012, 11:06 AM
Nils Kassube
 
Default Why the discrepancy in date?

Dotan Cohen wrote:
> For determining the current date, my date functions roundtrip just
> fine: ✈saturn:~$ date
> Sun Jan 8 12:32:24 IST 2012
> ✈saturn:~$ date +%s
> 1326018753
> ✈saturn:~$ date -d @1326018753
> Sun Jan 8 12:32:33 IST 2012
>
>
> However, for dates in the past they do not:
> ✈saturn:~$ date +%s -d 2006-12-31t22:00
> 1167577200

Interesting - why do you use "t" instead of " " as a separator between
date and time?

> ✈saturn:~$ date -d @1167577200
> Sun Dec 31 17:00:00 IST 2006
> ✈saturn:~$
>
> Notice that 22:00 became 17:00 - that is a five hour difference!
>
> As can be seen, I am on IST, which is UTC+2, so it does not account
> for the discrepancy:

Well, IST probably isn't the reason because here the same happens with
my time zone being CET (UTC+1):

~/ > date +%s -d 2006-12-31t22:00
1167577200
~/ > LC_ALL=C date -d @1167577200
Sun Dec 31 16:00:00 CET 2006

(I used the "LC_ALL=C" to get an English output string.)
However if I use " " instead of "t" as separator between date and time,
I get what I would expect:

~/ > date +%s -d "2006-12-31 22:00"
1167598800
~/ > LC_ALL=C date -d @1167598800
Sun Dec 31 22:00:00 CET 2006

So to me it looks like your "t" separator makes the date command use the
time zone UTC+7 intead of your local time zone. Furthermore, if I
specify a time zone together with your "t" separator, date complains
about an invalid date:

~/ > LC_ALL=C date +%s -d "2006-12-31t22:00 UTC"
date: invalid date `2006-12-31t22:00 UTC'


Nils

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-08-2012, 01:50 PM
Dotan Cohen
 
Default Why the discrepancy in date?

On Sun, Jan 8, 2012 at 14:06, Nils Kassube <kassube@gmx.net> wrote:
>> However, for dates in the past they do not:
>> ✈saturn:~$ date +%s -d 2006-12-31t22:00
>> 1167577200
>
> Interesting - why do you use "t" instead of " " as a separator between
> date and time?
>

Because then I do not need the quotes. It is also ISO standard 8601:
http://en.wikipedia.org/wiki/ISO_8601

✈saturn:~$ date +%s -d "2006-12-31 22:00"
1167595200
✈saturn:~$ date +%s -d 2006-12-31t22:00
1167577200

That is interesting, I've never noticed that behaviour before.

>> ✈saturn:~$ date -d @1167577200
>> Sun Dec 31 17:00:00 IST 2006
>> ✈saturn:~$
>>
>> Notice that 22:00 became 17:00 - that is a five hour difference!
>>
>> As can be seen, I am on IST, which is UTC+2, so it does not account
>> for the discrepancy:
>
> Well, IST probably isn't the reason because here the same happens with
> my time zone being CET (UTC+1):
>
> ~/ > date +%s -d 2006-12-31t22:00
> 1167577200
> ~/ > LC_ALL=C date -d @1167577200
> Sun Dec 31 16:00:00 CET 2006
>
> (I used the "LC_ALL=C" to get an English output string.)
> However if I use " " instead of "t" as separator between date and time,
> I get what I would expect:
>
> ~/ > date +%s -d "2006-12-31 22:00"
> 1167598800
> ~/ > LC_ALL=C date -d @1167598800
> Sun Dec 31 22:00:00 CET 2006
>
> So to me it looks like your "t" separator makes the date command use the
> time zone UTC+7 intead of your local time zone. Furthermore, if I
> specify a time zone together with your "t" separator, date complains
> about an invalid date:
>
> ~/ > LC_ALL=C date +%s -d "2006-12-31t22:00 UTC"
> date: invalid date `2006-12-31t22:00 UTC'
>

Even specifying UTC (that is the Z timezone) doesn't help:
✈saturn:~$ date +%s -d "2006-12-31 22:00Z"
1167602400
✈saturn:~$ date -d @1167602400
Mon Jan 1 00:00:00 IST 2007
✈saturn:~$ date +%s -d "2006-12-31 22:00"
1167595200
✈saturn:~$ date -d @1167595200
Sun Dec 31 22:00:00 IST 2006
✈saturn:~$


I do not believe that there should be a difference when using the T separator.


--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-08-2012, 03:09 PM
Nils Kassube
 
Default Why the discrepancy in date?

Dotan Cohen wrote:
> On Sun, Jan 8, 2012 at 14:06, Nils Kassube <kassube@gmx.net> wrote:
> >> However, for dates in the past they do not:
> >> ✈saturn:~$ date +%s -d 2006-12-31t22:00
> >> 1167577200
> >
> > Interesting - why do you use "t" instead of " " as a separator
> > between date and time?
>
> Because then I do not need the quotes. It is also ISO standard 8601:
> http://en.wikipedia.org/wiki/ISO_8601

Ah, that's the reason - I didn't know about that standard.

> > So to me it looks like your "t" separator makes the date command
> > use the time zone UTC+7 intead of your local time zone.
> > Furthermore, if I specify a time zone together with your "t"
> > separator, date complains about an invalid date:
> >
> > ~/ > LC_ALL=C date +%s -d "2006-12-31t22:00 UTC"
> > date: invalid date `2006-12-31t22:00 UTC'
>
> Even specifying UTC (that is the Z timezone) doesn't help:
> ✈saturn:~$ date +%s -d "2006-12-31 22:00Z"
> 1167602400
> ✈saturn:~$ date -d @1167602400
> Mon Jan 1 00:00:00 IST 2007

But that looks correct to me - if IST = UTC+2, then "2006-12-31 22:00Z"
is the same as "Mon Jan 1 00:00:00 IST 2007", isn't it?

> I do not believe that there should be a difference when using the T
> separator.

Agreed, it seems there is a bug in the date command. When it reads that
"t" separator it shouldn't take it as a time zone.


Nils

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-08-2012, 04:10 PM
Marius Gedminas
 
Default Why the discrepancy in date?

On Sun, Jan 08, 2012 at 05:09:48PM +0100, Nils Kassube wrote:
> Dotan Cohen wrote:
> > On Sun, Jan 8, 2012 at 14:06, Nils Kassube <kassube@gmx.net> wrote:
> > >> However, for dates in the past they do not:
> > >> ✈saturn:~$ date +%s -d 2006-12-31t22:00
> > >> 1167577200
> > >
> > > Interesting - why do you use "t" instead of " " as a separator
> > > between date and time?
> >
> > Because then I do not need the quotes. It is also ISO standard 8601:
> > http://en.wikipedia.org/wiki/ISO_8601
>
> Ah, that's the reason - I didn't know about that standard.
>
> > > So to me it looks like your "t" separator makes the date command
> > > use the time zone UTC+7 intead of your local time zone.
> > > Furthermore, if I specify a time zone together with your "t"
> > > separator, date complains about an invalid date:
...
> > I do not believe that there should be a difference when using the T
> > separator.
>
> Agreed, it seems there is a bug in the date command. When it reads that
> "t" separator it shouldn't take it as a time zone.

Note that it accepts almost any single-letter military timezone
specification[1] between the date and the time.

[1] http://en.wikipedia.org/wiki/List_of_military_time_zones

$ LC_ALL=C TZ=UTC date -d 20120101a12:00
Sun Jan 1 13:00:00 UTC 2012
$ LC_ALL=C TZ=UTC date -d 20120101b12:00
Sun Jan 1 14:00:00 UTC 2012
$ LC_ALL=C TZ=UTC date -d 20120101c12:00
Sun Jan 1 15:00:00 UTC 2012
...
$ LC_ALL=C TZ=UTC date -d 20120101s12:00
Sun Jan 1 06:00:00 UTC 2012
$ LC_ALL=C TZ=UTC date -d 20120101t12:00
Sun Jan 1 05:00:00 UTC 2012
$ LC_ALL=C TZ=UTC date -d 20120101u12:00
Sun Jan 1 04:00:00 UTC 2012

$ LC_ALL=C TZ=UTC date -d 20120101z12:00
Sun Jan 1 12:00:00 UTC 2012

I suspect the code was written before ISO-8601 even existed.

Marius Gedminas
--
If something has not yet gone wrong then it would ultimately have been
beneficial for it to go wrong.
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-09-2012, 07:47 AM
Dotan Cohen
 
Default Why the discrepancy in date?

It turns out that this issue is fixed in date 8.13. The current Ubuntu
is still on date 8.5 without the fix.

Thanks!

--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-09-2012, 11:08 AM
"W. Scott Lockwood III"
 
Default Why the discrepancy in date?

> -----Original Message-----
> It turns out that this issue is fixed in date 8.13. The current Ubuntu is
still on
> date 8.5 without the fix.
>
> Thanks!
>
> --
> Dotan Cohen
>
> http://gibberish.co.il
> http://what-is-what.com

[W. Scott Lockwood III]
Is there a version available in a backports repo?


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-09-2012, 12:05 PM
Dotan Cohen
 
Default Why the discrepancy in date?

On Mon, Jan 9, 2012 at 14:08, W. Scott Lockwood III
<vladinator@gmail.com> wrote:
> Is there a version available in a backports repo?
>

I haven't looked, but I doubt it. Try the 12.04 alphas, they should be
on the latest kernel and GNU tools.


--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-10-2012, 07:39 AM
Dotan Cohen
 
Default Why the discrepancy in date?

On Mon, Jan 9, 2012 at 14:08, W. Scott Lockwood III
<vladinator@gmail.com> wrote:
> Is there a version available in a backports repo?
>

Bob Proulx sent me a recent date binary for Squeeze. It works fine in
Kubuntu 11.10. Note that I didn't compile it, but I trust the guy who
did! The list rejected my attachment, so I am sending the binary to
Scott in a private mail. If anyone else needs it, then reply back.

--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 04:15 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org