From 53e1d863b66d7d84ec88c815ecd60e2759e2b782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Mon, 18 Mar 2019 18:43:22 +0100 Subject: [PATCH] 2019-03-18 update --- content/blog/cli-world-clock.md | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 content/blog/cli-world-clock.md diff --git a/content/blog/cli-world-clock.md b/content/blog/cli-world-clock.md new file mode 100644 index 0000000..f448d85 --- /dev/null +++ b/content/blog/cli-world-clock.md @@ -0,0 +1,36 @@ +--- +title: "Bash Snippet: CLI World Clock" +date: 2019-03-18T00:00:00+02:00 +--- + +When working in a global organization, colleagues are all around the world! +And thus answering to *"What time is it in their timezone?"* becomes a frequent +task. I initially used an online service for this but it is cumbersome and +requires me to leave my terminal. + +Let's meet the CLI World clock! + +```sh +function t() { + for tz in Europe/Paris Europe/Dublin US/Eastern US/Central US/Pacific; do + echo -e "$tz:\t$(TZ=$tz date -R)" + done +} +``` + +You can copy/paste this snippet in your terminal or add it to your `.bashrc` +to have it handy on every open terminal. + +Each time I want to know which time it is for my colleagues, I run the `t` +command: + +```raw +$ t +Europe/Paris: Mon, 18 Mar 2019 18:33:49 +0100 +Europe/Dublin: Mon, 18 Mar 2019 17:33:49 +0000 +US/Eastern: Mon, 18 Mar 2019 13:33:49 -0400 +US/Central: Mon, 18 Mar 2019 12:33:49 -0500 +US/Pacific: Mon, 18 Mar 2019 10:33:49 -0700 +``` + +The timezones used here comes from `/usr/share/zoneinfo/`.