]> zdv2.bktei.com Git - BK-2020-03.git/blobdiff - user/bkdatev
feat(unitproc/bkt-dateDuration):Count seconds between two dates
[BK-2020-03.git] / user / bkdatev
old mode 100644 (file)
new mode 100755 (executable)
index 3c2fac2..3ab8c3b
@@ -2,11 +2,12 @@
 # Desc: Baltakatei's verbose date command
 # Usage: bkdatev [args]
 # Example: bkdatev --date="2001-09-11T09:02:59-04"
-# Version: 0.3.3
+# Version: 1.0.2
 # Depends: GNU Coreutils 8.32, Bash 3.2.57
 # Ref/Attrib: [1] "ISO 8601". Wikipedia. https://en.wikipedia.org/wiki/ISO_8601
 #             [2] "Changing the Locale in Wine" https://stackoverflow.com/a/16428951
 #             [3] "Shanghai vs Beijing" https://bugs.launchpad.net/ubuntu/+source/libgweather/+bug/228554
+#             [4] “Understanding the "right" time zone database” https://kenta.blogspot.com/2016/03/sqfzcxay-understanding-right-time-zone.html
 # Notes:  * Check `ls -R /usr/share/zoneinfo` for time zone names.
 #         * Check `cat /usr/share/i18n/SUPPORTED` for supported locales.
 #         * For list of valid locales, see: https://manpages.ubuntu.com/manpages/bionic/man3/DateTime::Locale::Catalog.3pm.html
@@ -145,7 +146,9 @@ main() {
     (
         export TZ=UTC;
         id="UTC";
-        fs_3="+%s seconds since 1970-01-01T00:00+00";
+        date_string="$(date -Is)";
+        right_epoch="$(TZ=right/UTC date --date="$date_string" +%s;)"; # see [4]
+        fs_3="+%s seconds (${right_epoch} with leap seconds) since 1970-01-01T00:00+00";
         print_dateline "$@";
     ); line_sep;
 
@@ -261,6 +264,14 @@ main() {
         print_dateline "$@";
     ); line_sep;
 
+    # Helsinki, Finland
+    (
+        export TZ=Europe/Helsinki;
+        export LANG="fi_FI.UTF8";
+        id="HELSINKI";
+        print_dateline "$@";
+    ); line_sep;
+
     # Cairo, Egypt
     (
         export TZ=Africa/Cairo;
@@ -269,6 +280,22 @@ main() {
         print_dateline "$@";
     ); line_sep;
 
+    # Gaza City, Palestine (pop. (2017): 590,481)
+    (
+        export TZ=Asia/Gaza;
+        export LANG="ar_JO.UTF-8"; # ar_PS is missing as of 2023-10-18, using ar_JO as closest substitute.
+        id="GAZA";
+        print_dateline "$@";
+    ); line_sep;
+
+    # Tel Aviv, Israel (pop. (2021): 467,875)
+    (
+        export TZ=Asia/Tel_Aviv;
+        export LANG="he_IL.UTF-8";
+        id="TEL AVIV";
+        print_dateline "$@";
+    ); line_sep;
+
     # Athens (pop. (2020): 3,526,887)
     (
         export TZ=Europe/Athens;