classification
Title: strptime() makes an error concerning second in arg
Type: compile error Stage:
Components: None Versions: Python 2.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: facundobatista, nevgor
Priority: normal Keywords:

Created on 2008-07-03 11:47 by nevgor, last changed 2008-07-03 14:03 by nevgor. This issue is now closed.

Files
File name Uploaded Description Edit
unnamed nevgor, 2008-07-03 13:33
unnamed nevgor, 2008-07-03 14:03
Messages (5)
msg69192 - (view) Author: Neven Goršić (nevgor) Date: 2008-07-03 11:47
strptime() allows 60 and 61 sec, but not 62 sec in arg. string 

>>> s='02/28/2000 12:33:61 AM'
>>> time.strptime(s,'%m/%d/%Y %I:%M:%S %p')
(2000, 2, 28, 0, 33, 61, 0, 59, -1)

>>> s='02/28/2000 12:33:62 AM'
>>> time.strptime(s,'%m/%d/%Y %I:%M:%S %p')

Traceback (most recent call last):
  File "<pyshell#12>", line 1, in <module>
    time.strptime(s,'%m/%d/%Y %I:%M:%S %p')
  File "C:\Python25\lib\_strptime.py", line 330, in strptime
    (data_string, format))
ValueError: time data did not match format:  data=02/28/2000 12:33:62 AM
 fmt=%m/%d/%Y %I:%M:%S %p
msg69198 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2008-07-03 13:19
Minutes with 61 (0..60) and 62 (0..61) seconds are used to adjust the
theoretical calendar because of small differences with real world
rotation... 

Are you aware of any case where a minute with 63 seconds (0..62) should
be used?
msg69200 - (view) Author: Neven Goršić (nevgor) Date: 2008-07-03 13:33
Thank you for your reply, although is not helpful for me.

I use strptime() for datedate transformation and datatime boundaries
checking
and therefore I am not conserned in Reltivity theory.

When someone in datetime table enter 02:61:38 it is sign for me to
rise a warning and not to supposed that the gay is astrophysicist :)

-------------------------

On Thu, Jul 3, 2008 at 3:19 PM, Facundo Batista <report@bugs.python.org>
wrote:

>
> Facundo Batista <facundo@taniquetil.com.ar> added the comment:
>
> Minutes with 61 (0..60) and 62 (0..61) seconds are used to adjust the
> theoretical calendar because of small differences with real world
> rotation...
>
> Are you aware of any case where a minute with 63 seconds (0..62) should
> be used?
>
> ----------
> nosy: +facundobatista
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue3269>
> _______________________________________
>
msg69201 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2008-07-03 13:49
Closing as invalid, two reasons:

- Your original issue was that time.strptime() didn't allow 62 seconds,
not that it allowed 60 or 61.

- If you use it to validate input... how do you actually know that
03/25/2012 17:13:61 AM' is an invalid date?

I suggest to bring this issue in the python list if you have further doubts.

Thank you!!
msg69202 - (view) Author: Neven Goršić (nevgor) Date: 2008-07-03 14:03
- My original issue was that time.strptime() makes difference between 61 and
62 seconds
- 17h AM, 78 s, 128min everyone can easly transform correctly, I just wanted
to use function for
  boundarie checking: rising error for 62 sec and not for 61 is confusing!
- I just wanted to point out that Python should be consistent: to provide
the same behaviour for 60,61 and 62 sec.

The conclusion is over as far as I am concerned.
I got the picture (you standpoint), and I hope, you too.

Thank you, once again,

Regards

     Neven

----------------------

On Thu, Jul 3, 2008 at 3:49 PM, Facundo Batista <report@bugs.python.org>
wrote:

>
> Facundo Batista <facundo@taniquetil.com.ar> added the comment:
>
> Closing as invalid, two reasons:
>
> - Your original issue was that time.strptime() didn't allow 62 seconds,
> not that it allowed 60 or 61.
>
> - If you use it to validate input... how do you actually know that
> 03/25/2012 17:13:61 AM' is an invalid date?
>
> I suggest to bring this issue in the python list if you have further
> doubts.
>
> Thank you!!
>
> ----------
> resolution:  -> invalid
> status: open -> closed
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue3269>
> _______________________________________
>
History
Date User Action Args
2008-07-03 14:03:56nevgorsetfiles: + unnamed
messages: + msg69202
2008-07-03 13:49:20facundobatistasetstatus: open -> closed
resolution: not a bug
messages: + msg69201
2008-07-03 13:33:32nevgorsetfiles: + unnamed
messages: + msg69200
2008-07-03 13:19:43facundobatistasetnosy: + facundobatista
messages: + msg69198
2008-07-03 11:47:35nevgorcreate