Get a datetime with nanoseconds

I

Igor Korot

Hi, ALL,
I am woking on an application for digital forensic.
In this application I am getting this 2 pieces of information:

atime - long representing the time stamp
atime_nano - long representing the nanoseconds.

What I'd like to do is to have a python datetime object which will be a
representation of those 2 values.
I can get a datetime object out of atime timestamp, but I don't know how to
do it for atime_nano.

I did a little research. It looks like people on SO are saying that I will
not be able to get this kind of precision, but I'd be grateful if I can at
least get the best possible precision (millioseconds?) it would be great.

Thank you for any pointers.
 
A

Asaf Las

Hi, ALL,

I am woking on an application for digital forensic.

In this application I am getting this 2 pieces of information:

 

atime - long representing the time stamp

atime_nano - long representing the nanoseconds.

 

What I'd like to do is to have a python datetime object which will be a representation of those 2 values.

I can get a datetime object out of atime timestamp, but I don't know
how to do it for atime_nano.

I did a little research. It looks like people on SO are saying
that I will not be able to get this kind of precision, but I'd
be grateful if I can at least get the best possible precision
(millioseconds?) it would be great.

Thank you for any pointers.

i think you mix 2 issues here:

- get date time for specific point in time from system with nanosecond
precision. If i am wrong then to what "SO are saying that I will
not be able to get this kind of precision" is related?

- and how to have datetime to support nanosecond. That should be
straightforward and isn't hard. You should implement class having
datetime class instance stored and another member for nanosecond
portion. Yet implement datetime operators and members to mimic all
of that in original class.

/Asaf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top