SLOPE: A proposal for better time representation
jonhmchan.com
jonhmchan.com
Unless there is a 'year, month, day', the use of this is probably more theoretical than real.
Don't get me wrong: it is OK as a tool for time-series analysis. But then again, it will lose the Seasons very shortly. And then... A Gregorian update will be needed.
Take incrementing the timestamp by one day, for example. Intuition would direct you to split the ISO string into it's components, increment the DD data, and reconstruct it. However, it's far more complicated than that: months have different numbers of days, and it would require modifying both MM and DD if so (leap years taken into account too). You may need to increment the year as well if DD==12. Something this simple shouldn't be so difficult. Most languages have standard libraries that contain methods to handle these complexities, but it's a nightmare to deal with different protocols for each to do so. With SLOPE, the point in time can be incremented easily without confusion: add 606024 (86400) to the "start."
I'm probably going to make a follow-up post to address this one issue (it's a big one). With some code, I think it becomes more clear.
As for the seasons and Gregorian point...well...
This suggestion has at least one major design flaw - you can not represent many common recurrences using seconds. Not every day has 86,400 seconds, not every month has 30 days, not every year has 365 days.
When it comes to representing time in seconds, in a development setting, the method is surprisingly rigorous. It certainly can't account for certain kinds of recurrence: i.e. the first Monday of each month, account for leap years, etc. However, for most use cases, it's sufficient.
What I'm trying to do here with SLOPE is something much more basic though. One could certainly represent time as a JSON object, but as I mentioned near the end of the post, it could even be represented as a single string:
> start;length;offset1,offset2...;period;end
With any of the semicolon delimited portions removed in order. So instead of using a typical timestamp in YYYY-MM-DDTHH:MM:SSTZ, you use a SLOPE string instead. It makes it much more easy to compute across all situations irrespective of the platform being used.