From 49cdc0047fbe0119bb197724bd5cb9dbfeda7132 Mon Sep 17 00:00:00 2001 From: EmacsConf Organizers Date: Sat, 8 Oct 2022 14:32:44 +0000 Subject: Work with different system timezone --- emacsconf-publish.el | 11 +++++++---- emacsconf-schedule.el | 2 +- emacsconf.el | 30 +++++++++++++++++++++--------- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/emacsconf-publish.el b/emacsconf-publish.el index cf73bf9..9d60fb8 100644 --- a/emacsconf-publish.el +++ b/emacsconf-publish.el @@ -556,8 +556,11 @@ Entries are sorted chronologically, with different tracks interleaved." (height 150) (width 600)) (mapconcat (lambda (day) - (let ((day-start (date-to-time (format-time-string "%Y-%m-%d 9:00" (plist-get (cadr day) :start-time)))) - (day-end (date-to-time (format-time-string "%Y-%m-%d 17:00" (plist-get (cadr day) :start-time))))) + (let ((day-start (date-to-time + (concat (format-time-string "%Y-%m-%dT09:00" (plist-get (cadr day) :start-time)) + emacsconf-timezone-offset))) + (day-end (date-to-time (concat (format-time-string "%Y-%m-%dT17:00" (plist-get (cadr day) :start-time)) + emacsconf-timezone-offset)))) ;; (with-temp-file (expand-file-name (concat emacsconf-year "/talks/" ;; (format-time-string "schedule-%Y-%m-%d.svg" ;; (plist-get (cadr day) :start-time) @@ -688,8 +691,8 @@ Entries are sorted chronologically, with different tracks interleaved." :time (plist-get o :time) :startutc (format-time-string "%FT%T%z" (plist-get o :start-time) t) :endutc (format-time-string "%FT%T%z" (plist-get o :end-time) t) - :start (format-time-string "%-l:%M" (plist-get o :start-time)) - :end (format-time-string "%-l:%M" (plist-get o :end-time))))))) + :start (format-time-string "%-l:%M" (plist-get o :start-time) emacsconf-timezone) + :end (format-time-string "%-l:%M" (plist-get o :end-time) emacsconf-timezone)))))) (while attrs (let ((field (pop attrs)) (val (pop attrs))) diff --git a/emacsconf-schedule.el b/emacsconf-schedule.el index d679e32..43243f1 100644 --- a/emacsconf-schedule.el +++ b/emacsconf-schedule.el @@ -315,7 +315,7 @@ Each function should take the info and manipulate it as needed, returning the ne (y . ,(- height 2 label-margin)) (font-size . 10) (text-anchor . "middle")) - (svg--encode-text (format-time-string "%-l" time))))) + (svg--encode-text (format-time-string "%-l" time emacsconf-timezone))))) (setq time (time-add time (seconds-to-time 3600))))) elem)) diff --git a/emacsconf.el b/emacsconf.el index a5ba782..ddcee94 100644 --- a/emacsconf.el +++ b/emacsconf.el @@ -255,16 +255,24 @@ (expand-file-name "captions" (expand-file-name emacsconf-year emacsconf-directory))) :conf-year emacsconf-year :start-time (when (org-entry-get (point) "SCHEDULED") - (org-timestamp-to-time - (org-timestamp-split-range - (org-timestamp-from-string - (org-entry-get (point) "SCHEDULED"))))) + (date-to-time + (concat + (format-time-string "%Y-%m-%dT%H:%M:%S" + (org-timestamp-to-time + (org-timestamp-split-range + (org-timestamp-from-string + (org-entry-get (point) "SCHEDULED"))))) + emacsconf-timezone-offset))) :end-time (when (org-entry-get (point) "SCHEDULED") - (org-timestamp-to-time - (org-timestamp-split-range - (org-timestamp-from-string - (org-entry-get (point) "SCHEDULED")) - t)))) + (date-to-time + (concat + (format-time-string "%Y-%m-%dT%H:%M:%S" + (org-timestamp-to-time + (org-timestamp-split-range + (org-timestamp-from-string + (org-entry-get (point) "SCHEDULED")) + t))) + emacsconf-timezone-offset)))) (let* ((entry-props (org-entry-properties))) (mapcar (lambda (o) (list (car o) (assoc-default (cadr o) entry-props))) @@ -650,6 +658,10 @@ Include some other things, too, such as emacsconf-year, title, name, email, url, ;; Timezones (defvar emacsconf-date "2022-12-03" "Starting date of EmacsConf.") +(defvar emacsconf-timezone-offset + (format-time-string "%z" (date-to-time emacsconf-date) emacsconf-timezone) + "Timezone offset for `emacsconf-timezone' on `emacsconf-date'.") + (defun emacsconf-convert-from-timezone (timezone time) (interactive (list (completing-read "From zone: " tzc-time-zones) (read-string "Time: "))) -- cgit v1.2.3