dlowe-net / local-time

Time manipulation library for Common Lisp
Other
102 stars 43 forks source link

Functional interface with the same aliases as ADJUST-TIMESTAMP? #86

Open phmarek opened 5 years ago

phmarek commented 5 years ago

ADJUST-TIMESTAMP takes specifications with :SEC, :MINUTE, :HOUR etc. (why :MINUTE and not :MIN, btw?) to change data; but the getter functions are TIMESTAMP-SECOND, TIMESTAMP-MINUTE, TIMESTAMP-HOUR etc.

It would be nice to have either SETF functions with the same names (TIMESTAMP-SECOND etc.), or to have a function that uses the specifications from ADJUST-TIMESTAMP (a copy of %CONSTRUCT-TIMESTRING looks like a good candidate), to have a consistent way to access the parts of a timestamp.

The (TIMESTAMP-PART :SEC) version might be easier to use, as a single part name is sufficient for both getting and setting; the SETF TIMESTAMP-SECOND idea would again need passing two different functions on to the function. (Yeah, I could do (FUNCALL (ENSURE-FUNCTION (list 'setf name)) new-value timestamp), but that's not so nice, is it?)

Well, one common way to get/set things would be nice.