ldrda
October 13, 2023, 1:24pm
1
I have a problem with the timestamp when saving data - it always saves the time with + 1 second.
I’ve already set up a github issue, but in over 3 weeks no one has responded.
opened 07:02AM - 20 Sep 23 UTC
I already incorrectly created the [issue on the client library which I'm using](… https://github.com/influxdata/influxdb-client-csharp/issues/575), but according to everything, it is a bug of InfluxDb.
The problem is that even if I send save request with a valid timestamp (seconds precision), for some reason the record is always saved with 1 second added.
Ticks before save: 638270928000000000 (2023/08/08 12:00:00)
It's also correctly converted into unix timestamp: 1691496000 (2023/08/08 12:00:00)
Ticks when query record: 638270928010000000 (2023/08/08 12:00:01)
It's also same wrong time in InfluxDb Data Explorer.
![image](https://github.com/influxdata/influxdb-client-csharp/assets/23525231/88b3f461-84f5-4543-b69a-0c543888d38c)
__Steps to reproduce:__
curl -X POST "http://localhost:8086/api/v2/write?org=organization&bucket=test-bucket&precision=s"
--header "Authorization: Token my-super-secret-auth-token"
--header "Content-Type: text/plain"
--data-binary "measurement_curl,field_name=value value=42i 1691496000"
__Expected behavior:__
Record is saved with DateTime 2023/08/08 12:00:00
__Actual behavior:__
Record is saved with DateTime 2023/08/08 12:00:01
__Specifications:__
- InfluxDB Version: 2.7.1
- Platform: .NET 7, InfluxDb running in docker, MacOS
__Environment info:__
docker-compose:
influxdb:
image: influxdb:2.7.1
container_name: influxdb
hostname: host_influx_db
volumes:
- influx_db:/var/lib/influxdb
ports:
- 8086:8086
restart: unless-stopped
environment:
- DOCKER_INFLUXDB_INIT_MODE=setup
- DOCKER_INFLUXDB_INIT_USERNAME=admin
- DOCKER_INFLUXDB_INIT_PASSWORD=adminadmin
- DOCKER_INFLUXDB_INIT_ORG=organization
- DOCKER_INFLUXDB_INIT_BUCKET=test-bucket
- DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=my-super-secret-auth-token
__Workaround:__
DateTime with .AddMicroseconds(-1) (2023/08/08 11:59:59) correctly saves it as 2023/08/08 12:00:00
Please reply, thank you.
Hello @ldrda ,
Welcome!
I’ve literally never encountered this issue before.
It doesn’t feel like an InfluxDB issue to me. I commented on the issue. I think its rounding up for seconds.
Id suggest creating an issue for the client library instead.
Thank you for sharing.