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


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

Re: How to properly get the microseconds from the timestamps?

Started byVlastimil Brom <vlastimil.brom@gmail.com>
First post2014-04-22 11:15 +0200
Last post2014-04-22 11:15 +0200
Articles 1 — 1 participant

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How to properly get the microseconds from the timestamps? Vlastimil Brom <vlastimil.brom@gmail.com> - 2014-04-22 11:15 +0200

#70493 — Re: How to properly get the microseconds from the timestamps?

FromVlastimil Brom <vlastimil.brom@gmail.com>
Date2014-04-22 11:15 +0200
SubjectRe: How to properly get the microseconds from the timestamps?
Message-ID<mailman.9429.1398158127.18130.python-list@python.org>
2014-04-22 4:38 GMT+02:00 Igor Korot <ikorot01@gmail.com>:
...
>>>> datetime.datetime.fromtimestamp(1092787200/1000.0)
> datetime.datetime(1970, 1, 13, 7, 33, 7, 200000)
>
> Is there a way to know if the timestamp has a microseconds?
>
> Thank you.
> --
Hi,
I believe, in these cases, you can just test, whether there is a
non-integer part in the timestamp in seconds, which will be stored as
microseconds accordingly.
>>> 1092787200/1000.0
1092787.2
0.2 s is stored (and shown in repr(...)) as  200000  microseconds.

There are some peculiarities in handling date and time calculations
reliably as well as in the floating point math, but they don't seem to
be involved here.

[toc] | [standalone]


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


csiph-web