Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #65888 > unrolled thread

Get a datetime with nanoseconds

Started byIgor Korot <ikorot01@gmail.com>
First post2014-02-10 21:42 -0800
Last post2014-02-11 03:57 -0800
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Get a datetime with nanoseconds Igor Korot <ikorot01@gmail.com> - 2014-02-10 21:42 -0800
    Re: Get a datetime with nanoseconds Asaf Las <roegltd@gmail.com> - 2014-02-11 03:57 -0800

#65888 — Get a datetime with nanoseconds

FromIgor Korot <ikorot01@gmail.com>
Date2014-02-10 21:42 -0800
SubjectGet a datetime with nanoseconds
Message-ID<mailman.6652.1392097344.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

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.

[toc] | [next] | [standalone]


#65902

FromAsaf Las <roegltd@gmail.com>
Date2014-02-11 03:57 -0800
Message-ID<d7c65648-8ceb-4d09-b32f-18c08dc4beb1@googlegroups.com>
In reply to#65888
On Tuesday, February 11, 2014 7:42:16 AM UTC+2, Igor Korot wrote:
> 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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web