gfroerli / api

Coredump Gfrörli Water Temperature Sensor API
https://watertemp-api.coredump.ch/
GNU Affero General Public License v3.0
3 stars 0 forks source link

Date format: Unix timestamps? #54

Closed dbrgn closed 3 years ago

dbrgn commented 5 years ago

Right now we're using ISO8601 format to specify a point-in-time in the GET parameters (e.g. "created_after").

Elm consistently uses unix timestamps to store datetimes and argues that while ISO8601 is good for formatting and representing dates (yes I know XKCD 1179) it's bad for data transfer:

For our use case, we want to filter based on a point-in-time, e.g. we want to get all measurements of the last 60 minutes. For this use case, the time zone is irrelevant and a normalized UTC timestamp actually makes things easier.

Therefore: Would it make sense to consistently use unix timestamps in the API?

(Low priority issue, maybe something for an API v2?)

schmijos commented 5 years ago

I like the idea of using unix time stamps in general. But I'm unsure if it should be used for historical temperature measurement data. Do we store this forever? Would we import historical data let's say from the year 1850?

dbrgn commented 5 years ago

Do we store this forever? Would we import historical data let's say from the year 1850?

Hm, I can't quite follow.

My reasoning is that when I have a measurement and want to get all measurements within 24hours after that, we have to do the following:

With timestamps, we could do:

With time series, the absolute measurement time isn't even that important. The change over time and relative timespans (e.g. "3 days before now") are more important.

dbrgn commented 5 years ago

Would we import historical data let's say from the year 1850?

Definitely not. Seconds since 1970 UTC are a good specification for a point in time, we don't lose any information (but at the same time don't have to deal with time zones).