Giter Club home page Giter Club logo

tzc's Introduction

TZC

GitHub MELPA

Table of Contents

About

tzc is a small tool for Emacs to convert any time from one time-zone to another time-zone.

  • It supports tzdata database, e.g., America/New_York specifies the time-zone and daylight saving time history for locations near New York City. For more details, see the time-zone rules as described in the Emacs manual here.
  • zoneinfo could also be any string containg +-HHMM. It also works if the timeshift is given upto significant places, i. e., without the last digits when it is zero. For example, +-HH or +-HHM would work. For example instead of Asia/Kolkata one can use UTC+0530 or UTC+053 or GM+0530 or GM+053 and so on.
  • A list of all available zones in your system (MacOS (darwin) or Linux (gnu/linux)) is presented for autocompletion. So you can pick one easily.
  • In the unlikely case where a zone is not available in completion, you can add it to the list tzc-favourite-time-zones.

Installation

tzc is available in MELPA. See the instructions here on how to install a MELPA package. If you use use-package then the following would work

(use-package tzc
  :ensure t)

Customization

You can customize tzc-favourite-time-zones-alist to set your favourite time-zones and labels

(setq tzc-favourite-time-zones-alist '(("UTC+0000" "UTC")
					 ("Asia/Kolkata" "Kolkata")
					 ("America/New_York" "New York")
					 ("Europe/London" "London")
					 ("Europe/Berlin" "Berlin")
					 ("Asia/Shanghai" "Shanghai")
					 ("Asia/Tokyo" "Tokyo")))

How to use it

Convert a time between time zones

To convert a given time from from-zone to to-zone, use the interactive function tzc-convert-time.

Convert a time from one zone to a list of favourite time zones

You can set a list of favourite time zones using the variable tzc-favourite-time-zones and then use the interactive function tzc-convert-time-to-favourite-time-zones to get the time converted to your favourite time zones.

Convert and replace time at mark

Convert org time stamp

World clock

tzc-world-clock is similar to world-clock but with the extra feature that with n (next) or p (“previous”) key it will change the information on the buffer for the next or previous hours. Pressing g reverts it back to the current time.

tzc's People

Contributors

md-arif-shaikh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

emacsmirror

tzc's Issues

Failure to load tzdata on Android under Termux

The tzc-main-dir customizable var attempts some good guesses for finding tzdata files but there is a gap when it is invoked under Termux on Android. Executing the following script demonstrates the issue with querying system-type alone:

#!/usr/bin/env -S emacs --script

(mapcar
 (lambda (sym)
   (princ (concat
	   (symbol-name sym)
	   ":\t"
	   (let ((symv (symbol-value sym)))
	     (if (stringp symv)
	      symv
	      (symbol-name symv)))
	   "\n")))
 '(system-configuration system-type))

...which, under Termux, prints:

system-configuration:   aarch64-unknown-linux-android
system-type:    gnu/linux

The challenge is that Android does not follow Linux or macOS convention about splitting up timezone info into multiple files; rather, it offers a single concatenated file:

$ declare -p ANDROID_TZDATA_ROOT
declare -x ANDROID_TZDATA_ROOT="/apex/com.android.tzdata"
$ find "$ANDROID_TZDATA_ROOT" -type f -exec ls -sal --full-time '{}' '+'
find: ‘/apex/com.android.tzdata/lost+found’: Permission denied
  4 -rw-r--r-- 1 system system     26 1969-12-31 19:00:00.000000000 -0500 /apex/com.android.tzdata/apex_manifest.pb
236 -rw-r--r-- 1 system system 237600 1969-12-31 19:00:00.000000000 -0500 /apex/com.android.tzdata/etc/icu/icu_tzdata.dat
  4 -rw-r--r-- 1 system system    248 1969-12-31 19:00:00.000000000 -0500 /apex/com.android.tzdata/etc/tz/telephonylookup.xml
  4 -rw-r--r-- 1 system system     17 1969-12-31 19:00:00.000000000 -0500 /apex/com.android.tzdata/etc/tz/tz_version
440 -rw-r--r-- 1 system system 449437 1969-12-31 19:00:00.000000000 -0500 /apex/com.android.tzdata/etc/tz/tzdata
 36 -rw-r--r-- 1 system system  36717 1969-12-31 19:00:00.000000000 -0500 /apex/com.android.tzdata/etc/tz/tzlookup.xml

I'm figuring out what to do with this file organization and format in order to offer an actual fix, but for now I'm just opening this issue to log the discovery.

Different time for UK/London and Europe/London

Hi,

I just installed tzc, and while configuring it I realized that the time given for UK/London is different to that given for Europe/London, as you can see below from the tzc-world-clock command:

Canarias         09:13 Thu 12 May 2022 +0100
CET              10:13 Thu 12 May 2022 +0200
UTC              08:13 Thu 12 May 2022 +0000
New_York         04:13 Thu 12 May 2022 -0400
London           08:13 Thu 12 May 2022 +0000
London           09:13 Thu 12 May 2022 +0100
Madrid           10:13 Thu 12 May 2022 +0200

Any integration planned with the emacs built-in world-clock

Thanks for a nice package. I was looking for something like that. Btw, I am from Bengaluru as well. I work as a software developer and continuously used worldtimebuddy.com to schedule meeting across timezones.

Are there any integrations/improvement planned with the emacs inbuilt world-clock? There are two things which I can think of:

  • Use world-clock-list variable
  • Improve the wclock buffer to have keys (n,p) to see next hour or previous hour.
  • Allow date/time input using org style (similar) org-time-stamp function

Invalid conversion: tzc-convert-time EDT 23:00 => IST 23:00, which is wrong.

Hi,

I just downloaded this package and tried to convert between EDT (Easter Daylight Time) 23:00 to IST (India Standard Time) and the result was that they are equal, which is wrong.

Tested on Emacs 27.1
Here's a IELM session:

ELISP> (require 'tzc)
tzc
ELISP> (tzc-convert-time "23:00" "EDT" "IST") 
#("23:00 EDT = 23:00 IST" 0 5
  (face tzc-face-time-string)
  6 9
  (face tzc-face-time-zone-label)
  12 17
  (face tzc-face-time-string)
  18 21
  (face tzc-face-time-zone-label))

ELISP> 

Trying EST (Eastern Standard Time) did not work either:

ELISP> (tzc-convert-time "23:00" "EST" "IST") 
#("23:00 EST = 04:00 +1D IST" 0 5
  (face tzc-face-time-string)
  6 9
  (face tzc-face-time-zone-label)
  12 17
  (face tzc-face-time-string)
  17 21
  (face tzc-face-date-string)
  22 25
  (face tzc-face-time-zone-label))

ELISP> 

23:00 EDT is 08:30 IST.

Refresh *tzc-wclock* buffer

When I invoke M-x tzc-convert-current-time-to-favourite-time-zones the *tzc-wclock* buffer appears with the times of my favorite time zones, which is great.

However if I invoke it again at a later time, the buffer remains the
same (it will just popup with the old info).

Can it be refreshed instead?

Thanks!

PS. I love this package - I was thinking about attempting to write
something similar about a year ago, but this is far and away better
than anything I would have come up with! So thank you! (This type of
functionality should be built into emacs core imo ;))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.