summary refs log tree commit diff
diff options
context:
space:
mode:
authorAstrid2017-08-10 09:25:47 -0700
committerAstrid2017-08-10 09:25:57 -0700
commit177e4734a82d8f9eb38cb0f49a4c538cac0da953 (patch)
treedae756b23c2acb368d4569793db63db338744f13
Initial version
-rw-r--r--README11
-rwxr-xr-xworldclock18
2 files changed, 29 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..9396cd5
--- /dev/null
+++ b/README
@@ -0,0 +1,11 @@
+I needed a quick and dirty world clock in my terminal, so I made this.
+Every second it prints out a bunch of clocks.
+
+$ ./worldclock
+Thu Aug 10 09:22:01 PDT 2017     America/Los_Angeles
+Thu Aug 10 16:22:01 UTC 2017     UTC
+Thu Aug 10 17:22:01 BST 2017     Europe/London
+Thu Aug 10 18:22:01 CEST 2017    Europe/Berlin
+Fri Aug 11 00:22:01 MYT 2017     Asia/Kuala_Lumpur
+Fri Aug 11 00:22:01 SGT 2017     Asia/Singapore
+1502382121       unix
diff --git a/worldclock b/worldclock
new file mode 100755
index 0000000..57c6926
--- /dev/null
+++ b/worldclock
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+ZONES="America/Los_Angeles UTC Europe/London Europe/Berlin Asia/Kuala_Lumpur Asia/Singapore unix"
+
+while :
+do
+    clear
+	echo
+    for TZ in $ZONES ; do
+        if [ $TZ = "unix" ] ; then
+            TIME=$( date +%s )
+        else
+            TIME=$( date )
+        fi
+        echo -e $TIME "\t" $TZ
+    done
+    sleep 1
+done