emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Randomcoder <randomcoder1@gmail.com>
To: Ken Mankoff <mankoff@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [proposal] timezone-aware timestamps enhancement
Date: Fri, 20 Mar 2015 11:40:09 +0200	[thread overview]
Message-ID: <20150320094009.GC7494@xw> (raw)
In-Reply-To: <m2sid2i3dw.fsf@gmail.com>

On Wed, Mar 18, 2015 at 02:09:31PM -0400, Ken Mankoff wrote:
> I have a solution that works quite well outside of Org. Apple Calendar
> supports timezones plus a "floating" option.  I use Org for all my
> floating events - local to the computer and me, whatever TZ we're in. I
> haven't found a way to put TZ-specific events into Org.
> 
> If scheduling a Skype with someone in NZ, I enter it in iCal at the NZ
> time in the NZ timezone. Org pulls in my iCal events. Then wherever I
> am when that event happens, I get the alert at the correct time. Most
> things are local to me, so I use "floating" and stay in Org.

I wrote a silly elisp function that does the conversion for me.  Hah,
yeah ! exactly, I use it for the exact same thing, scheduling an interview
with someone on the other side of the planet.

So for example they ask me 

"Can you provide us with times when you're available for an interview ?"
and I just make a table and let them decide when:

    | time Tokyo         | time Sofia             |
    |--------------------+------------------------|
    | <2015-03-20 18:00> | <2015-03-20 Fri 11:00> |
    | <2015-03-21 14:00> | <2015-03-21 Sat 07:00> |
    | <2015-03-22 14:00> | <2015-03-22 Sun 07:00> |
    | <2015-03-23 14:00> | <2015-03-23 Mon 07:00> |
    | <2015-03-24 14:00> | <2015-03-24 Tue 07:00> |
    #+TBLFM: $1='(concat "<" (org-tz-conv $2 "Asia/Tokyo" "to") ">")

You said above you're using iCal (do you mean, Google Calendar or
Apple Calendar?). I'd be interested in setting this up as well, which one
should I be using ?

At this point in time I'm using Org-Mode's agenda to view events.
Should I try to sync them up with my phone and if so what is the recommended
way to go ?



This is the implementation of org-tz-conv:

    (defun org-tz-conv (stamp tz way)
      (let* (
             (current-tz-offset (shell-command-to-string "date +%z"))
             (stamp1    (concat (replace-regexp-in-string "[<>]" "" stamp) " " current-tz-offset))
             (date-cmd-p0  "TZ=%s date -d \"%s\"")
             (date-cmd-p1  "date --date=\"TZ=\\\"%s\\\" %s\"")
             (date-cmd-p2  " +\"%F %H:%M\"")
             (date-cmd-rendered1  (format date-cmd-p1 tz stamp1 ))
             (date-cmd-from  (concat date-cmd-rendered1 date-cmd-p2))
             (date-cmd-to    (concat (format date-cmd-p0 tz stamp1) date-cmd-p2))
             
             (shell-result-from (shell-command-to-string date-cmd-from ))
             (shell-result-to   (shell-command-to-string date-cmd-to   ))

             (result-from (replace-regexp-in-string "\n" "" shell-result-from) )
             (result-to   (replace-regexp-in-string "\n" "" shell-result-to  ) )
             )
        (message shell-result-from)
        (message shell-result-to)
        (cond ((string-equal way "from") result-from)
              ((string-equal way "to"  ) result-to  ))
        ))

  reply	other threads:[~2015-03-20  9:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18  8:13 [proposal] timezone-aware timestamps enhancement Randomcoder
2015-03-18 16:33 ` Eric S Fraga
2015-03-18 18:09   ` Ken Mankoff
2015-03-20  9:40     ` Randomcoder [this message]
2015-03-20 19:11       ` Ken Mankoff
2015-03-23 11:33       ` e.fraga
2015-03-20  9:29   ` Randomcoder
2015-03-23 11:35     ` e.fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150320094009.GC7494@xw \
    --to=randomcoder1@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mankoff@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).