bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20850: acknowledged by developer (Re: bug#20850: Converting under Li


From: Pádraig Brady
Subject: bug#20850: acknowledged by developer (Re: bug#20850: Converting under Linux a by date calculated epochtime back with date, does not return the same data)
Date: Mon, 22 Jun 2015 13:52:00 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 22/06/15 13:05, Bahn, Ingo wrote:
> Hello Pádraig / GNU (coreutils) team,
> 
> I hope you had a good weekend and thank you for the quick reply. I appreciate 
> that.
> 
> The -u (UTC) option I also attempted before opening the bug with you, but 
> also got the same different results between Linux and Cygwin.
> 
> But anyways, I guess I found the reason on why I got different results here, 
> when executing this command on Cygwin under Windows 7 and on different Linux 
> distributions.
> 
> The timestamp I got from the performance reports of one of our vendors 
> contains a capital "T" between the actual DATESTAMP and the TIMESTAMP:
> "2015-06-18T06:27:01"
> 
> So when I attempted to convert it into epochtime with the date command in the 
> first place, I was actually happy about I could do it just like that and did 
> not dig any deeper into this.
> 
> But apparently whatever character is between the DATESTAMP and the TIMESTAMP 
> here, influences some kind of offset:
> 
> Here is what I get when I convert the actual epoch-start-time "01-Jun-1970 
> 00:00:00":
> 
> #####---- LINUX - CentOS, SuSE
> #
> #-- Conversion with a WHITESPACE between DATESTAMP and TIMESTAMP returns "0":
> date -u -d "1970-01-01 00:00:00" +%s
> 0
> 
> #-- Conversion with a capital "T" between DATESTAMP and TIMESTAMP returns 
> "-25200":
> date -u -d "1970-01-01T00:00:00" +%s
> -25200
> 
> ##### ---- Windows7 - CygWin
> #
> #-- Conversion with a WHITESPACE between DATESTAMP and TIMESTAMP returns "0":
> date -u -d "1970-01-01 00:00:00" +%s
> 0
> 
> #-- Conversion with a capital "T" between DATESTAMP and TIMESTAMP returns "0" 
> too:
>  date -u -d "1970-01-01T00:00:00" +%s
> 0
> 
> ... Apparently on CygWin this Offset returns "0" in both cases.
> 
> At the of my reply end pls. find for your references what is returned when 
> there are other characters of the alphabet between the DATESTAMP and TIMESTAMP
> 
> So I have no idea whether this is intentionally so or not, but I will update 
> my teams internally here at my organisation, to strip about any possibly 
> character between the DATESTAMP and the TIMESTAMP to get the same results 
> independant from the environment they write their code on. Because with a 
> WHITESPACE the offset appears to be "0" across the board.
> 
> I won#t pursue this topic / bug any further with you, but for sure will be 
> available in case of any additonal informations or data gathering would be 
> required from my end
> 
> Thank you again and have a succesfull week

I think what's happening here is you're using a date on Linux
that's before v8.13 (2011-09-08), i.e. that doesn't include this change:
before http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=c2ecbc9a

Hence the T is being interpreted as a military time zone.

To be compat with older date(1), it's probably best to `tr T ' '`

cheers,
Pádraig





reply via email to

[Prev in Thread] Current Thread [Next in Thread]