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


Groups > comp.lang.python > #67793

Re: Proper conversion of timestamp

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'mrab': 0.05; 'preferably': 0.05; '1000.': 0.09; 'python': 0.11; '*always*': 0.16; 'finney': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'igor': 0.16; 'integer.': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'precision.': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'seconds,': 0.16; 'seconds.': 0.16; 'timestamp': 0.16; 'timestamps': 0.16; 'zero,': 0.16; 'wrote:': 0.18; 'example': 0.22; 'header:User-Agent:1': 0.23; 'integer': 0.24; 'looks': 0.24; '(or': 0.24; 'question': 0.24; 'right.': 0.26; 'header:In-Reply-To:1': 0.27; 'gives': 0.31; 'writes:': 0.31; 'another': 0.32; "i'd": 0.34; 'received:84': 0.35; 'but': 0.35; 'seconds': 0.37; 'so,': 0.37; 'represent': 0.38; 'ben': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'pm,': 0.38; 'expect': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; "you're": 0.61; "you'll": 0.62; 'real': 0.63; 'such': 0.63; 'different': 0.65; 'us:': 0.65; 'mar': 0.68; 'presented': 0.69; 'milliseconds': 0.84; 'timestamps,': 0.84; 'divided': 0.91
X-CM-Score 0.00
X-CNFS-Analysis v=2.1 cv=JLW1sq6b c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=sASEtNAQL0YA:10 a=1K8QQjYBxE4A:10 a=ihvODaAuJD4A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=pGLkceISAAAA:8 a=JnKconFoI0G09IL1NPYA:9 a=7KkoTKrayPZ0YTAx:21 a=R7ZX-dmw6pA51GBZ:21 a=QEXdDO2ut3YA:10 a=MSl-tDqOz04A:10
X-AUTH mrabarnett:2500
Date Wed, 05 Mar 2014 04:11:05 +0000
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Proper conversion of timestamp
References <CA+FnnTy2zoJYzx+ExkHf8SsENppBLaQzp2zOC9WFYsLBYwK9Qg@mail.gmail.com> <lf5hes$ve3$1@ger.gmane.org> <CA+FnnTxuiNTeaTu7LEdPWvsSnbbirgXqaCS67p5HOrruQPcZ9A@mail.gmail.com> <5316730B.3080706@mrabarnett.plus.com> <CA+FnnTyvXW83OR-L78Xqx5gttv1BANiNHUGh7r5XFJkJ-bGedA@mail.gmail.com> <85siqxfk6s.fsf@benfinney.id.au>
In-Reply-To <85siqxfk6s.fsf@benfinney.id.au>
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.7788.1393992667.18130.python-list@python.org> (permalink)
Lines 49
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1393992667 news.xs4all.nl 2829 [2001:888:2000:d::a6]:46583
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:67793

Show key headers only | View raw


On 2014-03-05 02:33, Ben Finney wrote:
> Igor Korot <ikorot01@gmail.com> writes:
>
>> On Tue, Mar 4, 2014 at 4:42 PM, MRAB <python@mrabarnett.plus.com> wrote:
>> >> But this particular question is easy.
>> >>
>> >> What I have is a timestamp which reads: 1289410678L.
>> >>
>> > That's an integer. It looks like the timestamp is a whole number of
>> > seconds, so the number of milliseconds is 0. (I make it '2010-11-10
>> > 17:37:58'.)
>>
>> Well it is this particular timestamp.
>
> Which is what you presented as “what I have”.
>
I'd expect all of the timestamps to be the same type. That example is
an integer (a 'long' to be exact).

>> But I have a lot of files to process and some do have a timestamp with
>> the milliseconds.
>
> So, if you want help with such timestamps, you'll need to present a real
> example (or preferably several exmaples) of timestamps that need this
> handling.
>
>> Right.
>> The question is: how to get the number of milliseconds out of
>> timestamp?
>
>  From the timestamp you showed: The number of milliseconds is zero, since
> it's an integer. That datatype will *always* have zero milliseconds.
>
>> Once again: I can get the datetime object with the seconds precision
>> by dividing it on 1000. But that will produce the datetime object with
>> the seconds precision.
>
> Because that's the data you're showing us: A timestamp with an integer
> number of seconds.
>
And in Python 2, an integer divided by an integer gives an integer.

>> I can actually produce another timestamp with the milliseconds from a
>> different file...
>
> Then you won't be able to represent it as an integer number of seconds.
> What are you receiving in the data? What data type is it?
>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Proper conversion of timestamp MRAB <python@mrabarnett.plus.com> - 2014-03-05 04:11 +0000

csiph-web