cl-json icon indicating copy to clipboard operation
cl-json copied to clipboard

cl-json:encode-json of local-time not useful

Open erjoalgo opened this issue 9 months ago • 3 comments

(cl-json:encode-json (local-time:now))
{"day":8845,"sec":63958,"nsec":58418000}

This encoding a Lisp timestamp is rarely useful outside of CL. Encoding as a unix timestamp would be more useful:

(defmethod cl-json:encode-json ((tstamp LOCAL-TIME:TIMESTAMP) &optional (stream t))
  "Encode timestamps as unix timestamps in json."
  (format stream "~A" (local-time:timestamp-to-unix tstamp)))

erjoalgo avatar May 19 '24 18:05 erjoalgo