On Aug 8, 4:40 am, Robert Latest <[EMAIL PROTECTED]> wrote: > Here's what happens on my Windows machine (Win XP / Cygwin) at work. > I've googled a bit about this problem but only found references to > instances where people referred to dates before the Epoch. > > Of course at home on my Linux box everything works.
And of course using the official versions of Python for Windows everything works: C:\junk>\python25\python Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> t = time.strptime("Mar 30, 2008 2:43:32 am", "%b %d, %Y %I:%M:%S %p") >>> time.mktime(t) 1206805412.0 >>> t (2008, 3, 30, 2, 43, 32, 6, 90, -1) >>> ^Z C:\junk>\python24\python Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> t = time.strptime("Mar 30, 2008 2:43:32 am", "%b %d, %Y %I:%M:%S %p") >>> time.mktime(t) 1206805412.0 >>> t (2008, 3, 30, 2, 43, 32, 6, 90, -1) >>> > > I know that everything has its limits somewhere, but I've never > heard of March 2008 being a problem. > > Tomorrow I'm going to write a test loop that shows me the exact last > second that mktime is going to be able to handle. Sort of like the way > Calvin's father explains the weight limit specification of bridges. > > I wonder if the datetime module is any better, considering that under > the hood it probably uses the same C library functions. Don't wonder; try it out; look at the source. > > I like to stick with the "seconds since..." approach because I need to > store millions of dates/times efficiently in a sqlite database. > > $ python > Python 2.5.1 (r251:54863, May 18 2007, 16:56:43) > [GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin There's your problem. > Type "help", "copyright", "credits" or "license" for more information.>>> > import time > >>> t = time.strptime("Mar 30, 2007 2:43:32 am", "%b %d, %Y %I:%M:%S > >>> %p") > >>> time.mktime(t) > 1175215412.0 > >>> t = time.strptime("Mar 30, 2008 2:43:32 am", "%b %d, %Y %I:%M:%S > >>> %p") > >>> time.mktime(t) > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > OverflowError: mktime argument out of range > -- http://mail.python.org/mailman/listinfo/python-list