1

I am trying to update a field created_at with a timestamp value. This created_at field, I have stored it as a float datatype. But it is not storing the value correctly. Even after a difference of 10-15 sec, it is still storing the same timestamp value. When I am trying to update its value, it is displaying the value which was stored long before. And this is only happening in case of float or double. String values are getting updated properly. But float and double values are not getting updated accordingly.

What could be the possible reason for it?

QCoder
  • 89
  • 4
  • How are you writing these changes and verifying they are successful? – Jon Feb 28 '23 at 11:48
  • @Jon I am using python's time.time() function and using vespa_connection.update_data() function to update this time for an id. When I am trying to update every 10 seconds, the value doesn't get updated. Its still the same as it was when I first ran the update_data() function. – QCoder Feb 28 '23 at 14:38
  • Thanks. I think Arne is pointing out the true problem here though. – Jon Feb 28 '23 at 18:56

1 Answers1

4

float has only 24 bits of precision and is a very bad choice for timestamp; if you're using standard seconds-since-epoch you'll only get a new value every 128 seconds. "double" should be better and works just fine for me, but I would recommend using "long" instead.

Arne
  • 76
  • 2