Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.057 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'great.': 0.07; 'cc:addr :python-list': 0.11; 'python': 0.11; 'igor': 0.16; 'pointers.': 0.16; 'precision,': 0.16; 'all,': 0.19; 'pieces': 0.19; 'saying': 0.22; 'cc:addr:python.org': 0.22; 'month,': 0.24; "haven't": 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'least': 0.26; 'header:In-Reply- To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'getting': 0.31; 'research.': 0.31; 'values.': 0.31; 'probably': 0.32; 'url:python': 0.33; 'skip:d 20': 0.34; "i'd": 0.34; 'could': 0.34; 'subject:with': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'grateful': 0.36; 'representing': 0.36; 'done': 0.36; 'url:listinfo': 0.36; 'possible': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'application': 0.37; 'thank': 0.38; 'url:library': 0.38; 'little': 0.38; 'anything': 0.39; 'url:mail': 0.40; 'how': 0.40; 'url:3': 0.61; 'digital': 0.61; 'kind': 0.63; 'to:addr:gmail.com': 0.65; 'subject:Get': 0.68; 'information:': 0.72; 'stamp': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=SWiBNl6ap7pkPBXqyF4D3bLSVS+ljjEyfMAjAHwiQ5M=; b=wJpmW9cJhpXDDMzNxXMGU1l3ZcAvI2ns7SZnzwOCUo22FXp4md1RgUGubdooXmht3m CVsFoOo4Th3q4A2ikwRfIu4TjnObU1NIld84YVhfL9y8wO9g6zbMaIk/WsDT3WxW7Iyb y1tsobiRAduIwFVlnf/i4FoF+gfcm3bCGHlKWlyNtLNJHMpA5hqbNx/nRIE+wtBKvOsH zhorVWzZaOP58fS1pHLw4J1HvtpVCX2jvIjOlcg+z7HvPlnnaotXOLR297Pm76FwAKMu l9pxogvKklafVXb1GlAIf0Ir1i/GhOoZl39jJdheS/AZMbKNk+bS9Cf0Hj/+PB5C0dUw TN7A== MIME-Version: 1.0 X-Received: by 10.224.165.133 with SMTP id i5mr56662960qay.75.1392117066858; Tue, 11 Feb 2014 03:11:06 -0800 (PST) In-Reply-To: References: Date: Tue, 11 Feb 2014 12:11:06 +0100 Subject: Re: Get a datetime with nanoseconds From: Vlastimil Brom To: Igor Korot Content-Type: text/plain; charset=ISO-8859-1 Cc: python X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392117075 news.xs4all.nl 2951 [2001:888:2000:d::a6]:55292 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65900 2014-02-11 6:42 GMT+01:00 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. > > -- > https://mail.python.org/mailman/listinfo/python-list > Hi, it seems, datetime has support for microseconds datetime.datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None) http://docs.python.org/3.3/library/datetime.html#datetime.datetime I haven't done anything using this precision, but I guess, microseconds could be used out of the box; for some higher precision, you'd probably need to code your own datatype. hth, vbr