473,606 Members | 3,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

time.mktime memory access violation bug

Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright" , "credits" or "license" for more information.
import time
time.mktime((19 69, 12, 31, 17, 0, 0, 0, 0, 0)) 3600.0 time.mktime((19 69, 12, 31, 17, 0, 0, 0, 0, 1)) 0.0 time.mktime((19 69, 12, 31, 16, 0, 0, 0, 0, 1))

[crash with popup]
I got:

The instruction at "0x7802a7ff " referenced memory at "0x00000000 ". The memory
could not be "read".

I would have hoped for an informative ValueError exception.

This is on NT4. My local time zone is PST.

If I let the MSVC++6 debugger try to chase it, it says
Unhandled exception in python.exe (MSVCRT.DLL): 0xC0000005: Access Violation

and fwiw without source it's pointing to the rep movs in this context:

7802A7F1 call 7802A4BF
7802A7F6 pop ecx
7802A7F7 push 9
7802A7F9 mov esi,eax
7802A7FB mov eax,dword ptr [ebp+8]
7802A7FE pop ecx
7802A7FF rep movs dword ptr [edi],dword ptr [esi]
7802A801 pop edi
7802A802 pop esi
7802A803 pop ebp
7802A804 ret
7802A805 test ecx,ecx
and esi is zero, so I guess that did it.

Someone have a debug version to check this out?

Regards,
Bengt Richter
Jul 18 '05 #1
2 2500
Bengt Richter wrote:
Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright" , "credits" or "license" for more information.
>>> import time
>>> time.mktime((19 69, 12, 31, 17, 0, 0, 0, 0, 0)) 3600.0 >>> time.mktime((19 69, 12, 31, 17, 0, 0, 0, 0, 1)) 0.0 >>> time.mktime((19 69, 12, 31, 16, 0, 0, 0, 0, 1)) [crash with popup]


Curious. I get (windows XP):

Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright" , "credits" or "license" for more information.
import time
time.mktime((19 69, 12, 31, 17, 0, 0, 0, 0, 0)) Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowError: mktime argument out of range time.mktime((19 69, 12, 31, 17, 0, 0, 0, 0, 1)) Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowError: mktime argument out of range time.mktime((19 69, 12, 31, 16, 0, 0, 0, 0, 1)) Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowError: mktime argument out of range


On Linux I get the same results. Something fishy is going
on with your Python...

--Irmen de Jong

Jul 18 '05 #2
On Wed, 19 Nov 2003 02:10:36 +0100, Irmen de Jong <irmen@-NOSPAM-REMOVETHIS-xs4all.nl> wrote:
Bengt Richter wrote:
Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright" , "credits" or "license" for more information.
>>> import time
>>> time.mktime((19 69, 12, 31, 17, 0, 0, 0, 0, 0))

3600.0
>>> time.mktime((19 69, 12, 31, 17, 0, 0, 0, 0, 1))

0.0
>>> time.mktime((19 69, 12, 31, 16, 0, 0, 0, 0, 1))

[crash with popup]


Curious. I get (windows XP):

Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright" , "credits" or "license" for more information.
import time
time.mktime((19 69, 12, 31, 17, 0, 0, 0, 0, 0))Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowErro r: mktime argument out of range time.mktime((19 69, 12, 31, 17, 0, 0, 0, 0, 1))Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowErro r: mktime argument out of range time.mktime((19 69, 12, 31, 16, 0, 0, 0, 0, 1))Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowErro r: mktime argument out of range


On Linux I get the same results. Something fishy is going
on with your Python...

Well, you're in a different time zone. I think you have to compensate for
that in setting up the equivalent of zero time epoch. Then hit that with dst=1.
Or there could be something fishy ;-)

Regards,
Bengt Richter
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6086
by: Marcus | last post by:
I am having some problems with trying to perform calculations on time fields. Say I have a start time and an end time, 1:00:00 and 2:30:00 (on a 24 hour scale, not 12). I want to find the difference in minutes, divide this result by a predefined size of interval, and make a loop that runs this many times. For example, with an interval size of 15 minutes, it will return 6 blocks... I have this all working fine, but am getting stuck on...
1
4676
by: Benoit BESSE | last post by:
Hi, I try to write a fonction which take a date and time and convert it into a NTP time. I have to use mktime but I did not work at all. Here is my code dans the exécution. Please help. Thanks def ToNTPTime(d,h): "Retuen a NTP time" year,month,day=d.split("/")
5
23828
by: Hank | last post by:
hi, i have a string as follows 18Nov2003:18:23:43:405 Is there an easy way to convert that to absolute time? What i really want to do is to parse these times from a log file and do time comparisons, averages, stop minus start (elapsed).
5
3639
by: David Stockwell | last post by:
I'm sure this has been asked before, but I wasn't able to find it. First off I know u can't change a tuple but if I wanted to increment a time tuple by one day what is the standard method to do that? I've tried the obvious things and haven't gotten very far. I have a time tuple that was created like this: aDate = '19920228' x = time.strptime(aDate,"%Y%m%d")
3
6798
by: Kyle Teague | last post by:
I have a list of pointers to structs as a private member of a class. If I call begin() in the same function as I added the data then no access violation occurs. However, if I try to call begin() in a member function of the same class I get a memory access violation. For example: // this is fine, no error void CBase::FuncA( void ) { plugin_info_t *plugin_info = new plugin_info_t;
14
2482
by: George | last post by:
In Time.h there is a structure defined for time settings. I'm building an embedded system that has a Real Time Clock but it's not PC compatible. My question is: I don't some elements of the structure such as day of the week or day of the year, but I do know year,month,date,hour,min,sec. Does the language support filling in the missing elements. And is there a consistency check for that time structure.
1
2458
by: BillyO | last post by:
In the attached code fragment I have a buffer overflow and a memory access violation. When I run the code .Net fails to verify the IL because of the buffer overflow and I get an exception as expected. My question relates to the memory access violation, specfically, what should happen? My guess is that since the good ole new operator allocates the memory we get an SEH memory access violation exception. Given that this can occur in my...
2
1500
by: Joshua J. Kugler | last post by:
I am getting results like these with the time module: %S'))) 1173610800 %S'))) 1173610800 '2007-03-11 03:00:00' I know it probably has something to do with daylight savings, but how can I get back out that which I put in? The times concerned are all standard
5
3601
by: alcool | last post by:
hi, I have 2 date/time values i.e. the system date/time and (h:m dd:mm:yyyy). I would like know to find a routine that calculate this difference. Maybe using the struct time_t and difftime. how I can do? Please help me.
0
8036
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7978
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8461
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8448
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
5987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5470
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3948
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2454
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1572
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.