Closed tmunro55 closed 5 years ago
Make sense. If you submit a PR, I'm happy to merge and release.
(Whoops! didn't mean to close)
Sorry, I have no idea what that is or how to do it.
-- Life moves too quickly, don't forget to stop and smell the roses. tmunro55@gmail.com or tim.munro@outlook.com
From: Zakir Durumeric Sent: November 25, 2018 10:34 PM To: zakird/pyad Cc: Tim; Author Subject: Re: [zakird/pyad] pyad time conversion error (#86)
Make sense. If you submit a PR, I'm happy to merge and release. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
There's some information here: https://help.github.com/articles/about-pull-requests/
Thanks
-- Life moves too quickly, don't forget to stop and smell the roses. tmunro55@gmail.com or tim.munro@outlook.com
From: Zakir Durumeric Sent: November 25, 2018 10:38 PM To: zakird/pyad Cc: Tim; Author Subject: Re: [zakird/pyad] pyad time conversion error (#86)
There's some information here: https://help.github.com/articles/about-pull-requests/ — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
I’m sorry, I’m totally lost here.
-- Life moves too quickly, don't forget to stop and smell the roses. tmunro55@gmail.com or tim.munro@outlook.com
From: Zakir Durumeric Sent: November 25, 2018 10:38 PM To: zakird/pyad Cc: Tim; Author Subject: Re: [zakird/pyad] pyad time conversion error (#86)
There's some information here: https://help.github.com/articles/about-pull-requests/ — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
I've submitted a pull request. Hope I did it correctly. --tim
@zakird it looks like this was pulled, can we close this issue?
Hello,
While learning how to use the pyad module, I came across and odd situation. I was playing with AD timestamps and one of them returned an actual value of zero. I checked both the high part and the low part and both where zero. When I called pyadutils.convert_time, it bombed with the following error:
File "C:\MyTools\temp\testingAD.py", line 17, in
sDate = pyadutils.convert_datetime(attr)
File "C:\Program Files (x86)\Python37-32\lib\site-packages\pyad\pyadutils.py", line 71, in convert_datetime
+ int(adsi_time_com_obj.lowpart)) - 116444736000000000),10000000))
OSError: [Errno 22] Invalid argument
It turns out the actual error is in datetime.datetime.fromtimestamp. The function cannot take a negative value. Any 64 bit timestamp passed to pyadutils.convert_datetime that results in a negative date value will cause the function to crash. I've modified the convert_datetime function to check for this, and return a date of '1970-01-01 00:00:00' which is the other Microsoft "zero date" value.
It would be nice if this could be updated in the pyad module and I hope this helps someone else down the road.