Message166345
On 07/24/2012 04:20 PM, R. David Murray wrote:
> R. David Murray <rdmurray@bitdance.com> added the comment:
>
> Are the nanosecond timestamps timestamps or strings? If they are timestamps it's not immediately obvious why you want to convert them to datetime objects, so motivating that would probably help. On the other hand the fact that you have an application that does so is certain an argument for real world applicability.
It depends. When they are exported for example as csv (this can be the
case of market stock) or json (which is close to my case) that's a
string so having a datetime object may be very helpful in doing datetime
adds, subs, <, deltas and in changing representation to human readable
format thanks to strftime() without loosing precison and maintaining
readability.
Think about a web application. User selects year, month, day, hour,
minute, millisecond, nanosecond of an event and the javascript does a
ajax call with time of this format (variant of iso8601):
YYYY-MM-DDTHH:MM:SS.mmmmmmnnn (where nnn is the nanosecond representation).
The python server takes that string, converts to a datetime, does all
the math with its data and gives the output back using labeling data
with int(nano_datetime.strftime('MMSSmmmmmmnnn')) so I've a sequence
number that javascript can sort and handle easily.
It's basically the same you already do nowadays at microseconds level,
but this time you have to deal with nanosecond data.
I agree with the YAGNI principle and I think that we have a clear
evidence of a real use case here indeed.
Best Regards |
|
Date |
User |
Action |
Args |
2012-07-25 00:42:23 | goshawk | set | recipients:
+ goshawk, lemburg, belopolsky, vstinner, Arfrever, r.david.murray |
2012-07-25 00:42:23 | goshawk | link | issue15443 messages |
2012-07-25 00:42:22 | goshawk | create | |
|