diff --git a/init.org b/init.org index 5ebc207..9be2e34 100644 --- a/init.org +++ b/init.org @@ -2417,6 +2417,25 @@ What if... :load-path "/media/data/anon/Documents/Text Files/programming/elisp/chronometrist/elisp/") #+END_SRC +#+BEGIN_SRC emacs-lisp +(defun my-copy-gpx-timestamps () + "Copy ISO-8601 timestamps from GPX data as ISO-8601 timestamps in local time." + (interactive) + (let* ((dom (libxml-parse-xml-region (point-min) (point-max))) + (trkseg (esxml-query "trkseg" dom)) + (first-trkpt (third trkseg)) + (first-iso (second (alist-get 'time first-trkpt))) + (first-unix (parse-iso8601-time-string first-iso)) + (last-trkpt (first (last trkseg))) + (last-iso (second (alist-get 'time last-trkpt))) + (last-unix (parse-iso8601-time-string last-iso)) + (plist (list :start (chronometrist-format-time-iso8601 first-unix) + :stop (chronometrist-format-time-iso8601 last-unix))) + (string (apply #'format "%S %S\n%S %S" plist))) + (kill-new string) + (apply #'message "Copied %S %S %S %S to kill ring" plist))) +#+END_SRC + *** count-expressions *** querying data An example of querying the Chronometrist file data - finding out how much time I've spent on tasks matching a certain criteria.