Issue #7445 has been updated by felipec (Felipe Contreras).


tadf (tadayoshi funaba) wrote:
> I will give written in Japanese English because I heard not hold water .

I've used Google translate which does a poor job, but you have left me no choice.

> Do not forget that you 're talking about what you DateTime .
> 
> That is written to the destination in the reference is not necessarily as it is Spoken . References
> It is not just a reference for a better understanding . Is natural . Is common sense .

Totally unparsable.

> quoted from (1) more
> > SEE ALSO
> > Vi (1), less (1)
> 
> or equivalent to less? more I have exceptional .
> 
> First of all , you should you have said already , but the machine perfectly 's% z%' as you say
> Nothing to be is! Performance . The syntax level you 're talking about is , read "
> It will only say "he . It has been described as possible with _strptime. Its
> For C, the members of the time zone is not a standard Somo also . Thailand from the original
> It is not symmetric about the time difference and time zones . What if , built-in classes of ruby
> Show How do you do in Time.
> 
> quoted from (3) lcoaltime
> > Struct tm {
> > Int tm_sec; / * seconds * /
> > Int tm_min; / * minutes * /
> > Int tm_hour; / * hours * /
> > Int tm_mday; / * day of the month * /
> > Int tm_mon; / * month * /
> > Int tm_year; / * year * /
> > Int tm_wday; / * day of the week * /
> > Int tm_yday; / * day in the year * /
> > Int tm_isdst; / * daylight saving time * /
> > };

I don't know what you are talking about, but we are not talking about Time, nor lcoaltime, which I pressume is actually localtime().

Time doesn't even have strptime(), so what's the point of bringing it up? I have no idea.

> Well as DateTime, Time of built-in class , library of C also is the same
> But, in order to properly accept , as well as the syntax level and have to interpret the meaning
> Must . Those that do not rely on the first elements and conflicting be ignored
> Will be . You're of sesame and pretend you do not notice it at all .
> 
> % s is intended to time_t , but there is no such a member to struct tm
> In fact , it should be stored in some cases local self-evident is decomposed so . Even if time difference
> I do not go , multiply Dzuna mind it's a little funny thing is , even if it is stored.
> The difference would be good if they match that of the local time , but it is not necessarily so
> Do . It would be implemented as soon as the first place and whether it is stored . mktime (3) is free it
> Coherence will fit if you view. Behavior of this area think that it is undefined in any
> There are . Is not the significance of ours to discuss .
> 
> # define _XOPEN_SOURCE
> # include <stdio.h>
> # include <time.h>
> 
> int main (int argc, char * argv []) {
> ????struct tm tm;
> ????char buf [100];
> ????strptime (argv [1], argv [2], & tm);
> ????strftime (buf, 100, "% F% T% z", & tm);
> ????printf ("% s \ n", buf);
> ????return 0;
> }
> 
> $. / A.out '3 +0100' '% s% z'
> 1970-01-01 09:00:03 +0100
> $. / A.out '3 -0100 ''% s% z '
> 1970-01-01 09:00:03 -0100
> 
> In this case, the difference was to be read indeed .
> 
> $ Date-d '1970-01-01 09:00:03 +0100' +% s
> 28803
> $ Date-d '1970-01-01 09:00:03 -0100 '+% s
> 36003
> 
> But , just I 'm just reading . Or something if symmetry 'm not a story .
> 
> Instance of Time and DateTime is an object, what mktime (3 ) basis
> You can not eliminate . I should have to as it is fraught elements inconsistent or DateTime
> It is not impossible in Time. Object is not a struct tm. You
> C still does not work , in fact that you are saying , and so any DateTime
> There is not even going to prepare Na . The fact that you said is nonsense at all .

Again, Time is irrelevant, we are talking about DateTime, so mktime() or whatever backend is used is irrelevant, the documentation mentions strptime(3), and strptime(3) accepsts '%s %z', therefore DateTime.strptime() should accept it too, and it can if the attached patch is applied.

> > Time.strptime ('1 +1200', '% s% z')
> # = > 1970-01-01 09:00:01 +0900
> > Time.strptime ('1 +2400', '% s% z')
> # = > 1970-01-01 09:00:01 +0900

Again, there is no strptime in Time.

Time.strptime('1 +1200', '%s %z')
NoMethodError: undefined method `strptime' for Time:Class
	from (irb):1
	from /usr/bin/irb:12:in `<main>'

> In fact , there are other combinations do not make sense . On the other hand , one by one
> I do not think it is trying to provide a correct interpretation . And be modified as you say in this matter
> Lever , so although I have not yet obtained the perfect symmetry .
> 
> > Time.strptime ('1 0 ','% s% w '). Wday
> # = > 4
> 
> > Time.strptime ('1 PM ','% s% p '). Hour
> # = > 9
> 
> > DateTime.new (2001,2,3,16,5,6). Strftime ('% F% T% p')
> # => "2001-02-03 16:05:06 PM"
> > DateTime.strptime ('% F% T% p', "2001-02-03 16:05:06 PM")
> ArgumentError: invalid date

That's because you are passing the arguments the other way around:

DateTime.strptime("2001-02-03 16:05:06 PM", '%F %T %p')
=> #<DateTime: 2001-02-03T16:05:06+00:00 ((2451944j,57906s,0n),+0s,2299161j)>

Geezus.

> I have never seen that the date format??ку?????'s% z%' to me. Time difference and time zone
> What is needed , it will be because it is local time in nature. % s 's shown ,
> In time_t, there is no information of the time difference and time zone to time_t. Its on Unix
> As given , self-explanatory , as there is no need to explain , just fire Re
> Only some convex , this is the basic .

Again, time_t is totally and completely irrelevant. strptime(3) and strftime(3) do NOT use it.

> For example, let's look at the ISO 8601. There a difference in local time , but the Universal time
> Would not . I do not know why actively accept this . Bug at least
> Not a . I do not know reason to say as a matter of course , you'd been accepted .
> 
> I have thought and time zone difference as something like modifier but , '% s% z'
> In There is nothing of interest. something 's% p%' is the same . Such things
> I do not think you must give a meaning to .

It doesn't matter what you think. strptime(3) does give a meaning to '%s %z'. Period.

> I think it strange that as a date you 's% z%' is attempting to represent . Its
> If interpret force the level , it is not a date , an incomplete copy of the date object
> I think that it is not only a kind of copy .

It is not incomplete, every date can be represented with '%s %z'.

That's why Git, the most successful DVCS by far, which is headed to
replace Subversion as the most popular VCS in general uses precisely
this:

---
% git cat-file -p trunk
tree 075a08c3e84f214ab9426957b3682b94c56b3046
parent bbf366bad8b51c491820b67338125d36b88c8fbe
author zzak <zzak / b2dd03c8-39d4-4d8f-98ff-823fe69b080e> 1380550541 +0000
committer zzak <zzak / b2dd03c8-39d4-4d8f-98ff-823fe69b080e> 1380550541 +0000

* ext/objspace/objspace.c: [DOC] Cleaned up many rdoc formatting
  issues and several duplicate grammar bugs.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
---

Oh, look at that '1380550541 +0000', so '%s %z', that's all Git uses to
represent dates, and it's not missing any information. Probably hundreds
of thousands, maybe even millions of people don't have a problem with
these dates.

Oh, and since I've worked on Mercurial and Bazaar, I can tell you that
these two fields is all they need as well.

> From it , because it may contain a leap second time_t, portability is poor . So ,
> This is even able to read and write in various places , is recommended the use of less active
> The fact that it will not also like I want to say . the built-in classes of ruby
> I do not feel the significance that I'll overdo it that you do not Spoken and even for . A new feature
> If " Use steadily . Bug was a bug because I grew out of it by this " Madashimo
> I do not want to say absolutely is .
> 
> Or future , it might be The possible as undefined behaviors . However , now
> I do not think at all of place , if you want to accept . It must be accepted right now to reverse
> Will there why not . Never complains about anyone until now , Oh
> Other than thou is .
> 
> You can see if you look at the code , but ignore consciously . Has been doing intended .
> Thought does not Hen~tsu also now, I feel to be persuaded you will not . Consent this
> Consult your great men of the other if you can not .

I don't understand what you mean, but it is a bug. The documentation says this.

"See also strptime(3) and strftime."

1) strptime(3) does work correctly with '%s %z'

2) strftime() 

> "This is not a bug " is the conclusion of me.

Well you are wrong, and your are completely unreasonable and uncooperative attitude is not helping, so I'm going to escalate to other channels.
----------------------------------------
Bug #7445: strptime('%s %z') doesn't work
https://bugs.ruby-lang.org/issues/7445#change-42118

Author: felipec (Felipe Contreras)
Status: Rejected
Priority: Low
Assignee: tadf (tadayoshi funaba)
Category: lib
Target version: Next Major
ruby -v: ruby 1.9.3p327
Backport: 


See:

    ruby -e "require 'date'; p DateTime.strptime('0 +0100', '%s %z').strftime('%s %z')"

The timezone is ignored.


-- 
http://bugs.ruby-lang.org/