Nano-second time resolution


#1

I have timestamp field with 100 nano seconds resolution. As 'instant’s can represent only in milli seconds, potentially 10K events can get bucketed in the same ‘instant’. One way to order and filer them correctly is to store entire timestamp in string form or the part beyond milli-second as ‘long’( or string) and use it for comparison.

  1. Are there other better/more efficient ways?
  2. Is datomic planning to provide native type for finer resolutions (microinstant, nanoinstant etc) of instant?

#2

Hello,

What about using a long similar to a unix timestamp to represent your time measure? You could even use two attributes, one for high resolution, and one for display purposes, if you really have to compute the human readable representation in advance.

Cam


#3

I already have it in human readable form, a string like “2017-11-11T13:49:02.097445800Z”. When I use datomic’s instant type, it becomes “2017-11-11T13:49:02.097Z”. I can just extract out “445800” and keep it in a separate ‘long’ attribute. Issue with this is that it spreads into every code involving time like ordering, displaying, duration calculation etc. Or I can store entire time in nano seconds (instead of millis) and use this one attribute (instead of two) in my code.